49#include "llvm/Support/ConvertUTF.h"
50#include "llvm/Support/SaveAndRestore.h"
53using llvm::RoundingMode;
75 if (TreatUnavailableAsInvalid &&
97 S.
Diag(Loc, diag::warn_used_but_marked_unused) << D;
106 if (
Decl->isDefaulted()) {
117 auto *Ctor = dyn_cast<CXXConstructorDecl>(
Decl);
118 if (Ctor && Ctor->isInheritingConstructor())
129 if (I->getStorageClass() !=
SC_None)
156 if (!Current->isInlined())
158 if (!Current->isExternallyVisible())
174 if (!DowngradeWarning && UsedFn)
177 S.
Diag(Loc, DowngradeWarning ? diag::ext_internal_in_extern_inline_quiet
178 : diag::ext_internal_in_extern_inline)
193 Diag(DeclBegin, diag::note_convert_inline_to_static)
212 bool ObjCPropertyAccess,
213 bool AvoidPartialAvailabilityChecks,
222 Diag(Suppressed.first, Suppressed.second);
233 if (cast<FunctionDecl>(D)->isMain())
234 Diag(Loc, diag::ext_main_used);
241 if (isa<BindingDecl>(D)) {
242 Diag(Loc, diag::err_binding_cannot_appear_in_own_initializer)
245 Diag(Loc, diag::err_auto_variable_cannot_appear_in_own_initializer)
253 if (FD->isDeleted()) {
254 auto *Ctor = dyn_cast<CXXConstructorDecl>(FD);
255 if (Ctor && Ctor->isInheritingConstructor())
256 Diag(Loc, diag::err_deleted_inherited_ctor_use)
258 << Ctor->getInheritedConstructor().getConstructor()->getParent();
260 Diag(Loc, diag::err_deleted_function_use);
273 if (FD->getTrailingRequiresClause()) {
281 diag::err_reference_to_function_with_unsatisfied_constraints)
301 if (
auto *MD = dyn_cast<CXXMethodDecl>(D)) {
303 if (MD->getParent()->isLambda() &&
304 ((isa<CXXConstructorDecl>(MD) &&
305 cast<CXXConstructorDecl>(MD)->isDefaultConstructor()) ||
306 MD->isCopyAssignmentOperator() || MD->isMoveAssignmentOperator())) {
307 Diag(Loc, diag::warn_cxx17_compat_lambda_def_ctor_assign)
312 auto getReferencedObjCProp = [](
const NamedDecl *D) ->
314 if (
const auto *MD = dyn_cast<ObjCMethodDecl>(D))
315 return MD->findPropertyDecl();
329 auto *DRD = dyn_cast<OMPDeclareReductionDecl>(
CurContext);
332 Diag(Loc, diag::err_omp_wrong_var_in_declare_reduction)
342 if (
LangOpts.OpenMP && isa<VarDecl>(D) &&
344 Diag(Loc, diag::err_omp_declare_mapper_wrong_var)
351 AvoidPartialAvailabilityChecks, ClassReceiver);
361 auto *FD = dyn_cast_or_null<FunctionDecl>(
CurContext);
364 const auto *VD = dyn_cast<VarDecl>(D);
365 if (VD && VD->hasGlobalStorage() && !VD->hasAttr<
CUDADeviceAttr>() &&
367 !VD->getType()->isCUDADeviceBuiltinSurfaceType() &&
368 !VD->getType()->isCUDADeviceBuiltinTextureType() &&
369 !VD->isConstexpr() && !VD->getType().isConstQualified())
370 targetDiag(*Locs.begin(), diag::err_ref_bad_target)
371 << 2 << 1 << VD <<
Target;
376 if (
auto *VD = dyn_cast<ValueDecl>(D))
380 if (
const auto *VD = dyn_cast<VarDecl>(D))
382 targetDiag(*Locs.begin(), diag::err_thread_unsupported);
385 if (isa<ParmVarDecl>(D) && isa<RequiresExprBodyDecl>(D->
getDeclContext()) &&
390 Diag(Loc, diag::err_requires_expr_parameter_referenced_in_evaluated_context)
410 unsigned numFormalParams;
414 enum CalleeType { CT_Function, CT_Method, CT_Block } calleeType;
417 numFormalParams = MD->param_size();
418 calleeType = CT_Method;
419 }
else if (
FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
420 numFormalParams = FD->param_size();
421 calleeType = CT_Function;
422 }
else if (isa<VarDecl>(D)) {
428 calleeType = CT_Function;
431 calleeType = CT_Block;
437 numFormalParams = proto->getNumParams();
450 assert((nullPos == 0 || nullPos == 1) &&
"invalid null position on sentinel");
451 numFormalParams = (nullPos > numFormalParams ? 0 : numFormalParams - nullPos);
454 unsigned numArgsAfterSentinel = attr->
getSentinel();
458 if (Args.size() < numFormalParams + numArgsAfterSentinel + 1) {
465 Expr *sentinelExpr = Args[Args.size() - numArgsAfterSentinel - 1];
466 if (!sentinelExpr)
return;
475 std::string NullValue;
479 NullValue =
"nullptr";
483 NullValue =
"(void*) 0";
486 Diag(Loc, diag::warn_missing_sentinel) <<
int(calleeType);
488 Diag(MissingNilLoc, diag::warn_missing_sentinel)
512 assert(!Ty.
isNull() &&
"DefaultFunctionArrayConversion - missing type");
516 if (
auto *FD = dyn_cast<FunctionDecl>(DRE->getDecl()))
521 CK_FunctionToPointerDecay).
get();
536 CK_ArrayToPointerDecay).
get();
548 if (UO && UO->getOpcode() == UO_Deref &&
549 UO->getSubExpr()->getType()->isPointerType()) {
551 UO->getSubExpr()->getType()->getPointeeType().getAddressSpace();
554 UO->getSubExpr()->IgnoreParenCasts()->isNullPointerConstant(
556 !UO->getType().isVolatileQualified()) {
558 S.
PDiag(diag::warn_indirection_through_null)
559 << UO->getSubExpr()->getSourceRange());
561 S.
PDiag(diag::note_indirection_through_null));
581 BaseType = BaseType->getPointeeType();
593 if (ObjectSetClass) {
637 assert(!T.isNull() &&
"r-value conversion on typeless expression?");
640 if (T->isFunctionType() || T->isArrayType())
647 T->isDependentType() ||
676 SourceRange(OISA->getOpLoc(), OISA->getIsaMemberLoc()),
")");
693 if (T.hasQualifiers())
694 T = T.getUnqualifiedType();
697 if (T->isMemberPointerType() &&
709 Cleanup.setExprNeedsCleanups(
true);
712 Cleanup.setExprNeedsCleanups(
true);
716 CastKind CK = T->isNullPtrType() ? CK_NullToPointer : CK_LValueToRValue;
724 T = Atomic->getValueType().getUnqualifiedType();
751 CK_FunctionToPointerDecay);
774 assert(!Ty.
isNull() &&
"UsualUnaryConversions - missing type");
817 assert(!Ty.
isNull() &&
"DefaultArgumentPromotion - missing type");
829 if (BTy && (BTy->
getKind() == BuiltinType::Half ||
830 BTy->
getKind() == BuiltinType::Float)) {
833 if (BTy->
getKind() == BuiltinType::Half) {
898 if (!Record->hasNonTrivialCopyConstructor() &&
899 !Record->hasNonTrivialMoveConstructor() &&
900 !Record->hasNonTrivialDestructor())
927 PDiag(diag::warn_cxx98_compat_pass_non_pod_arg_to_vararg) << Ty << CT);
934 PDiag(diag::warn_pass_class_arg_to_vararg)
942 PDiag(diag::warn_cannot_pass_non_pod_arg_to_vararg)
949 diag::err_cannot_pass_non_trivial_c_struct_to_vararg)
953 PDiag(diag::err_cannot_pass_objc_interface_to_vararg)
968 if (PlaceholderTy->getKind() == BuiltinType::ARCUnbridgedCast &&
1009 if (Call.isInvalid())
1014 if (Comma.isInvalid())
1021 diag::err_call_incomplete_argument))
1038 if (SkipCast)
return false;
1043 CK_FloatingRealToComplex);
1047 CK_IntegralComplexToFloatingComplex);
1057 bool IsCompAssign) {
1080 auto *LHSComplexType = dyn_cast<ComplexType>(LHSType);
1081 auto *RHSComplexType = dyn_cast<ComplexType>(RHSType);
1083 LHSComplexType ? LHSComplexType->getElementType() : LHSType;
1085 RHSComplexType ? RHSComplexType->getElementType() : RHSType;
1091 if (!IsCompAssign) {
1098 }
else if (Order > 0) {
1113 bool ConvertFloat,
bool ConvertInt) {
1118 CK_IntegralToFloating);
1129 CK_IntegralComplexToFloatingComplex);
1134 CK_FloatingRealToComplex);
1143 QualType RHSType,
bool IsCompAssign) {
1153 else if (!IsCompAssign)
1155 return LHSFloat ? LHSType : RHSType;
1160 if (LHSFloat && RHSFloat) {
1167 assert(order < 0 &&
"illegal float comparison");
1201 "The remaining types must be floating point types.");
1206 QualType LHSElemType = LHSComplex ?
1207 LHSComplex->getElementType() : LHSType;
1208 QualType RHSElemType = RHSComplex ?
1224 return Float128AndLongDouble &&
1226 &llvm::APFloat::PPCDoubleDouble());
1240 CK_IntegralComplexCast);
1246template <PerformCastFn doLHSCast, PerformCastFn doRHSCast>
1249 QualType RHSType,
bool IsCompAssign) {
1254 if (LHSSigned == RHSSigned) {
1257 RHS = (*doRHSCast)(S, RHS.
get(), LHSType);
1259 }
else if (!IsCompAssign)
1260 LHS = (*doLHSCast)(S, LHS.
get(), RHSType);
1262 }
else if (order != (LHSSigned ? 1 : -1)) {
1266 RHS = (*doRHSCast)(S, RHS.
get(), LHSType);
1268 }
else if (!IsCompAssign)
1269 LHS = (*doLHSCast)(S, LHS.
get(), RHSType);
1276 RHS = (*doRHSCast)(S, RHS.
get(), LHSType);
1278 }
else if (!IsCompAssign)
1279 LHS = (*doLHSCast)(S, LHS.
get(), RHSType);
1288 RHS = (*doRHSCast)(S, RHS.
get(), result);
1290 LHS = (*doLHSCast)(S, LHS.
get(), result);
1300 bool IsCompAssign) {
1304 if (LHSComplexInt && RHSComplexInt) {
1309 (S, LHS, RHS, LHSEltType, RHSEltType, IsCompAssign);
1314 if (LHSComplexInt) {
1318 (S, LHS, RHS, LHSEltType, RHSType, IsCompAssign);
1321 CK_IntegralRealToComplex);
1326 assert(RHSComplexInt);
1331 (S, LHS, RHS, LHSType, RHSEltType, IsCompAssign);
1336 CK_IntegralRealToComplex);
1345 assert(BTy &&
"Expected a builtin type.");
1347 switch (BTy->getKind()) {
1348 case BuiltinType::ShortFract:
1349 case BuiltinType::UShortFract:
1350 case BuiltinType::SatShortFract:
1351 case BuiltinType::SatUShortFract:
1353 case BuiltinType::Fract:
1354 case BuiltinType::UFract:
1355 case BuiltinType::SatFract:
1356 case BuiltinType::SatUFract:
1358 case BuiltinType::LongFract:
1359 case BuiltinType::ULongFract:
1360 case BuiltinType::SatLongFract:
1361 case BuiltinType::SatULongFract:
1363 case BuiltinType::ShortAccum:
1364 case BuiltinType::UShortAccum:
1365 case BuiltinType::SatShortAccum:
1366 case BuiltinType::SatUShortAccum:
1368 case BuiltinType::Accum:
1369 case BuiltinType::UAccum:
1370 case BuiltinType::SatAccum:
1371 case BuiltinType::SatUAccum:
1373 case BuiltinType::LongAccum:
1374 case BuiltinType::ULongAccum:
1375 case BuiltinType::SatLongAccum:
1376 case BuiltinType::SatULongAccum:
1379 if (BTy->isInteger())
1381 llvm_unreachable(
"Unexpected fixed point or integer type");
1393 "Expected at least one of the operands to be a fixed point type");
1396 "Special fixed point arithmetic operation conversions are only "
1397 "applied to ints or other fixed point types");
1419 QualType ResultTy = LHSTyRank > RHSTyRank ? LHSTy : RHSTy;
1441 REnum = R->isUnscopedEnumerationType();
1443 if ((!IsCompAssign && LEnum && R->isFloatingType()) ||
1446 ? diag::warn_arith_conv_enum_float_cxx20
1447 : diag::warn_arith_conv_enum_float)
1449 << (
int)ACK << LEnum << L << R;
1450 }
else if (!IsCompAssign && LEnum && REnum &&
1459 ? diag::warn_arith_conv_mixed_anon_enum_types_cxx20
1460 : diag::warn_arith_conv_mixed_anon_enum_types;
1465 ? diag::warn_conditional_mixed_enum_types_cxx20
1466 : diag::warn_conditional_mixed_enum_types;
1471 ? diag::warn_comparison_mixed_enum_types_cxx20
1472 : diag::warn_comparison_mixed_enum_types;
1475 ? diag::warn_arith_conv_mixed_enum_types_cxx20
1476 : diag::warn_arith_conv_mixed_enum_types;
1479 << (
int)ACK << L << R;
1511 LHSType = AtomicLHS->getValueType();
1514 if (LHSType == RHSType)
1523 QualType LHSUnpromotedType = LHSType;
1527 if (!LHSBitfieldPromoteTy.
isNull())
1528 LHSType = LHSBitfieldPromoteTy;
1533 if (LHSType == RHSType)
1580 Expr *ControllingExpr,
1583 unsigned NumAssocs = ArgTypes.size();
1584 assert(NumAssocs == ArgExprs.size());
1587 for (
unsigned i = 0; i < NumAssocs; ++i) {
1596 llvm::makeArrayRef(Types, NumAssocs),
1606 Expr *ControllingExpr,
1609 unsigned NumAssocs = Types.size();
1610 assert(NumAssocs == Exprs.size());
1620 ControllingExpr = R.
get();
1628 diag::warn_side_effects_unevaluated_context);
1630 bool TypeErrorFound =
false,
1632 ContainsUnexpandedParameterPack
1635 for (
unsigned i = 0; i < NumAssocs; ++i) {
1636 if (Exprs[i]->containsUnexpandedParameterPack())
1637 ContainsUnexpandedParameterPack =
true;
1640 if (Types[i]->
getType()->containsUnexpandedParameterPack())
1641 ContainsUnexpandedParameterPack =
true;
1643 if (Types[i]->
getType()->isDependentType()) {
1644 IsResultDependent =
true;
1649 if (Types[i]->
getType()->isIncompleteType())
1650 D = diag::err_assoc_type_incomplete;
1651 else if (!Types[i]->
getType()->isObjectType())
1652 D = diag::err_assoc_type_nonobject;
1653 else if (Types[i]->
getType()->isVariablyModifiedType())
1654 D = diag::err_assoc_type_variably_modified;
1657 Diag(Types[i]->getTypeLoc().getBeginLoc(), D)
1658 << Types[i]->getTypeLoc().getSourceRange()
1659 << Types[i]->getType();
1660 TypeErrorFound =
true;
1665 for (
unsigned j = i+1; j < NumAssocs; ++j)
1666 if (Types[j] && !Types[j]->
getType()->isDependentType() &&
1668 Types[j]->getType())) {
1669 Diag(Types[j]->getTypeLoc().getBeginLoc(),
1670 diag::err_assoc_compatible_types)
1671 << Types[j]->getTypeLoc().getSourceRange()
1672 << Types[j]->getType()
1673 << Types[i]->getType();
1674 Diag(Types[i]->getTypeLoc().getBeginLoc(),
1675 diag::note_compat_assoc)
1676 << Types[i]->getTypeLoc().getSourceRange()
1677 << Types[i]->getType();
1678 TypeErrorFound =
true;
1688 if (IsResultDependent)
1690 Exprs, DefaultLoc, RParenLoc,
1691 ContainsUnexpandedParameterPack);
1694 unsigned DefaultIndex = -1U;
1695 for (
unsigned i = 0; i < NumAssocs; ++i) {
1699 Types[i]->getType()))
1700 CompatIndices.push_back(i);
1706 if (CompatIndices.size() > 1) {
1710 Diag(ControllingExpr->
getBeginLoc(), diag::err_generic_sel_multi_match)
1713 for (
unsigned I : CompatIndices) {
1714 Diag(Types[I]->getTypeLoc().getBeginLoc(),
1715 diag::note_compat_assoc)
1716 << Types[I]->getTypeLoc().getSourceRange()
1717 << Types[I]->getType();
1725 if (DefaultIndex == -1U && CompatIndices.size() == 0) {
1739 unsigned ResultIndex =
1740 CompatIndices.size() ? CompatIndices[0] : DefaultIndex;
1743 Context, KeyLoc, ControllingExpr, Types, Exprs, DefaultLoc, RParenLoc,
1744 ContainsUnexpandedParameterPack, ResultIndex);
1762 assert(Args.size() <= 2 &&
"too many arguments for literal operator");
1765 for (
unsigned ArgIdx = 0; ArgIdx != Args.size(); ++ArgIdx) {
1766 ArgTy[ArgIdx] = Args[ArgIdx]->getType();
1767 if (ArgTy[ArgIdx]->isArrayType())
1794 assert(!StringToks.empty() &&
"Must have at least one string!");
1801 for (
const Token &
Tok : StringToks)
1809 }
else if (Literal.
isUTF8()) {
1813 }
else if (Literal.
isUTF16()) {
1816 }
else if (Literal.
isUTF32()) {
1827 Diag(StringTokLocs.front(), diag::warn_cxx20_compat_utf8_string);
1833 auto RemovalDiag =
PDiag(diag::note_cxx20_compat_utf8_string_remove_u8);
1835 for (
const Token &
Tok : StringToks) {
1836 if (
Tok.
getKind() == tok::utf8_string_literal) {
1845 Diag(RemovalDiagLoc, RemovalDiag);
1853 Kind, Literal.
Pascal, StrTy,
1855 StringTokLocs.size());
1867 return ExprError(
Diag(UDSuffixLoc, diag::err_invalid_string_udl));
1892 Expr *Args[] = { Lit, LenArg };
1911 llvm::APSInt
Value(CharBits, CharIsUnsigned);
1917 for (
unsigned I = 0,
N = Lit->
getLength(); I !=
N; ++I) {
1928 llvm_unreachable(
"unexpected literal operator lookup result");
1932 llvm_unreachable(
"unexpected literal operator lookup result");
1964 auto *DRE = dyn_cast<DeclRefExpr>(VD->
getInit());
1967 auto *Referee = dyn_cast<VarDecl>(DRE->getDecl());
1968 if (!Referee || !Referee->hasGlobalStorage() ||
1975 auto *MD = dyn_cast_or_null<CXXMethodDecl>(S.
CurContext);
1976 if (MD && MD->getParent()->isLambda() &&
1977 MD->getOverloadedOperator() == OO_Call && MD->hasAttr<
CUDADeviceAttr>() &&
1999 if (
VarDecl *VD = dyn_cast<VarDecl>(D)) {
2000 if (VD->getType()->isReferenceType() &&
2003 VD->isUsableInConstantExpressions(
Context))
2020 bool RefersToCapturedVariable =
2025 Context, NNS, TemplateKWLoc, D, RefersToCapturedVariable, NameInfo, Ty,
2055 FD = IFD->getAnonField();
2065 if (
auto *BD = dyn_cast<BindingDecl>(D))
2066 if (
auto *BE = BD->getBinding())
2091 Id.TemplateId->NumArgs);
2097 TemplateArgs = &Buffer;
2100 TemplateArgs =
nullptr;
2107 unsigned DiagnosticID,
unsigned DiagnosticSuggestID) {
2114 SemaRef.
Diag(TypoLoc, diag::err_no_member) << Typo << Ctx
2117 SemaRef.
Diag(TypoLoc, DiagnosticID) << Typo;
2122 bool DroppedSpecifier =
2125 ? diag::note_implicit_param_decl
2126 : diag::note_previous_decl;
2129 SemaRef.
PDiag(NoteID));
2132 << Typo << Ctx << DroppedSpecifier
2134 SemaRef.
PDiag(NoteID));
2149 bool isDefaultArgument =
2154 bool isInstance = CurMethod && CurMethod->
isInstance() &&
2163 unsigned DiagID = diag::err_found_in_dependent_base;
2164 unsigned NoteID = diag::note_member_declared_at;
2166 DiagID =
getLangOpts().MSVCCompat ? diag::ext_found_later_in_class
2167 : diag::err_found_later_in_class;
2169 DiagID = diag::ext_found_in_dependent_base;
2170 NoteID = diag::note_dependent_member_use;
2186 Diag(D->getLocation(), NoteID);
2195 if (isDefaultArgument && ((*R.
begin())->isCXXInstanceMember())) {
2213 unsigned diagnostic = diag::err_undeclared_var_use;
2214 unsigned diagnostic_suggest = diag::err_undeclared_var_use_suggest;
2218 diagnostic = diag::err_undeclared_use;
2219 diagnostic_suggest = diag::err_undeclared_use_suggest;
2228 if (isa<CXXRecordDecl>(DC)) {
2244 R.
addDecl(Best->FoundDecl.getDecl(), Best->FoundDecl.getAccess());
2261 assert(!ExplicitTemplateArgs &&
2262 "Diagnosing an empty lookup with explicit template args!");
2266 emitEmptyLookupTypoDiagnostic(TC, *this, SS, Name, TypoLoc, Args,
2267 diagnostic, diagnostic_suggest);
2276 bool DroppedSpecifier =
2280 bool AcceptableWithRecovery =
false;
2281 bool AcceptableWithoutRecovery =
false;
2290 dyn_cast<FunctionTemplateDecl>(CD))
2294 else if (
FunctionDecl *FD = dyn_cast<FunctionDecl>(CD))
2295 if (!ExplicitTemplateArgs || ExplicitTemplateArgs->
size() == 0)
2301 ND = Best->FoundDecl;
2302 Corrected.setCorrectionDecl(ND);
2306 Corrected.setCorrectionDecl(ND);
2337 AcceptableWithoutRecovery =
true;
2340 if (AcceptableWithRecovery || AcceptableWithoutRecovery) {
2342 ? diag::note_implicit_param_decl
2343 : diag::note_previous_decl;
2346 PDiag(NoteID), AcceptableWithRecovery);
2350 << DroppedSpecifier << SS.
getRange(),
2351 PDiag(NoteID), AcceptableWithRecovery);
2354 return !AcceptableWithRecovery;
2390 else if (
auto *MD = dyn_cast<CXXMethodDecl>(S.
CurContext))
2398 auto DB = S.
Diag(Loc, diag::ext_undeclared_unqual_id_with_dependent_base);
2399 DB << NameInfo.
getName() << RD;
2401 if (!ThisType.
isNull()) {
2404 Context,
nullptr, ThisType,
true,
2406 nullptr, NameInfo, TemplateArgs);
2423 bool HasTrailingLParen,
bool IsAddressOfOperand,
2425 bool IsInlineAsmIdentifier,
Token *KeywordReplacement) {
2426 assert(!(IsAddressOfOperand && HasTrailingLParen) &&
2427 "cannot be direct & operand and have a trailing lparen");
2459 bool DependentID =
false;
2461 Name.getCXXNameType()->isDependentType()) {
2463 }
else if (SS.
isSet()) {
2474 IsAddressOfOperand, TemplateArgs);
2481 if (TemplateKWLoc.
isValid() || TemplateArgs) {
2487 bool MemberOfUnknownSpecialization;
2490 MemberOfUnknownSpecialization, TemplateKWLoc,
2494 if (MemberOfUnknownSpecialization ||
2497 IsAddressOfOperand, TemplateArgs);
2506 IsAddressOfOperand, TemplateArgs);
2510 if (IvarLookupFollowUp) {
2534 if (R.
empty() && !ADL) {
2537 TemplateKWLoc, TemplateArgs))
2542 if (IsInlineAsmIdentifier)
2552 "Typo correction callback misconfigured");
2564 if (TE && KeywordReplacement) {
2566 auto BestTC = State.Consumer->getNextCorrection();
2567 if (BestTC.isKeyword()) {
2568 auto *II = BestTC.getCorrectionAsIdentifierInfo();
2569 if (State.DiagHandler)
2570 State.DiagHandler(BestTC);
2574 KeywordReplacement->
setLocation(BestTC.getCorrectionRange().getBegin());
2580 return (
Expr*)
nullptr;
2582 State.Consumer->resetCorrectionStream();
2587 assert(!R.
empty() &&
2588 "DiagnoseEmptyLookup returned false but added no results");
2605 assert(!R.
empty() || ADL);
2631 if (!R.
empty() && (*R.
begin())->isCXXClassMember()) {
2632 bool MightBeImplicitMember;
2633 if (!IsAddressOfOperand)
2634 MightBeImplicitMember =
true;
2636 MightBeImplicitMember =
false;
2638 MightBeImplicitMember =
false;
2640 MightBeImplicitMember =
true;
2646 if (MightBeImplicitMember)
2648 R, TemplateArgs, S);
2651 if (TemplateArgs || TemplateKWLoc.
isValid()) {
2659 "There should only be one declaration found.");
2698 if (
const auto *CD = dyn_cast<CXXRecordDecl>(DC))
2699 if (CD->isInvalidDecl())
2710 unsigned DiagID = diag::err_typename_missing;
2712 DiagID = diag::ext_typename_missing;
2714 auto D =
Diag(Loc, DiagID);
2745 if (!R.
empty() && (*R.
begin())->isCXXClassMember() && !IsAddressOfOperand)
2781 LookForIvars =
true;
2782 else if (IsClassMethod)
2783 LookForIvars =
false;
2794 if (IsClassMethod) {
2815 Diag(Loc, diag::warn_ivar_use_hidden) << IV->getDeclName();
2823 Diag(Loc, diag::err_ivar_use_in_class_method) << IV->getDeclName();
2836 "should not reference ivar from this context");
2839 assert(IFace &&
"should not reference ivar from this context");
2904 cast<ObjCIvarDecl>(Ivar.
get()));
2906 if (Lookup.
empty() && II && AllowBuiltinCreation)
2946 bool PointerConversions =
false;
2947 if (isa<FieldDecl>(
Member)) {
2951 DestRecordType, FromPtrType
2958 PointerConversions =
true;
2960 DestType = DestRecordType;
2961 FromRecordType = FromType;
2964 if (Method->isStatic())
2967 DestType = Method->getThisType();
2972 PointerConversions =
true;
2974 FromRecordType = FromType;
2975 DestType = DestRecordType;
2980 if (FromAS != DestAS) {
2985 if (PointerConversions)
3026 if (Qualifier && Qualifier->getAsType()) {
3028 assert(QType->
isRecordType() &&
"lookup done with non-record type");
3038 FromLoc, FromRange, &BasePath))
3041 if (PointerConversions)
3044 VK, &BasePath).
get();
3047 FromRecordType = QRecordType;
3058 FromLoc, FromRange, &BasePath,
3068 bool HasTrailingLParen) {
3070 if (!HasTrailingLParen)
3088 if (D->isCXXClassMember())
3097 if (isa<UsingShadowDecl>(D))
3099 else if (D->getLexicalDeclContext()->isFunctionOrMethod())
3106 if (isa<FunctionDecl>(D)) {
3112 }
else if (!isa<FunctionTemplateDecl>(D))
3128 if (isa<TypedefNameDecl>(D)) {
3133 if (isa<ObjCInterfaceDecl>(D)) {
3138 if (isa<NamespaceDecl>(D)) {
3150 const auto *FD = dyn_cast<FunctionDecl>(R.
getFoundDecl());
3152 (FD->isCPUDispatchMultiVersion() || FD->isCPUSpecificMultiVersion());
3157 bool AcceptInvalidDecl) {
3197 bool AcceptInvalidDecl) {
3198 assert(D &&
"Cannot refer to a NULL declaration");
3199 assert(!isa<FunctionTemplateDecl>(D) &&
3200 "Cannot refer unambiguously to a function template");
3206 if (
TemplateDecl *Template = dyn_cast<TemplateDecl>(D)) {
3216 Diag(Loc, diag::err_ref_non_value)
3237 if (!indirectField->isCXXClassMember())
3250 type = type.getNonPackExpansionType();
3254#define ABSTRACT_DECL(kind)
3255#define VALUE(type, base)
3256#define DECL(type, base) \
3258#include "clang/AST/DeclNodes.inc"
3259 llvm_unreachable(
"invalid value decl kind");
3262 case Decl::ObjCAtDefsField:
3263 llvm_unreachable(
"forming non-member reference to ivar?");
3267 case Decl::EnumConstant:
3268 case Decl::UnresolvedUsingValue:
3269 case Decl::OMPDeclareReduction:
3270 case Decl::OMPDeclareMapper:
3279 case Decl::IndirectField:
3280 case Decl::ObjCIvar:
3282 "building reference to field in C?");
3286 type = type.getNonReferenceType();
3292 case Decl::NonTypeTemplateParm: {
3294 type = reftype->getPointeeType();
3304 if (type->isRecordType()) {
3305 type = type.getUnqualifiedType().withConst();
3313 type = type.getUnqualifiedType();
3318 case Decl::VarTemplateSpecialization:
3319 case Decl::VarTemplatePartialSpecialization:
3320 case Decl::Decomposition:
3321 case Decl::OMPCapturedExpr:
3324 !type.hasQualifiers() &&
3325 type->isVoidType()) {
3331 case Decl::ImplicitParam:
3332 case Decl::ParmVar: {
3335 type = type.getNonReferenceType();
3342 if (!CapturedType.
isNull())
3343 type = CapturedType;
3349 case Decl::Binding: {
3352 type = type.getNonReferenceType();
3357 auto *DD = dyn_cast_or_null<VarDecl>(BD->getDecomposedDecl());
3358 if (DD && DD->hasLocalStorage())
3364 case Decl::Function: {
3365 if (
unsigned BID = cast<FunctionDecl>(VD)->getBuiltinID()) {
3394 if (!cast<FunctionDecl>(VD)->hasPrototype() &&
3395 isa<FunctionProtoType>(fty))
3404 case Decl::CXXDeductionGuide:
3405 llvm_unreachable(
"building reference to deduction guide");
3407 case Decl::MSProperty:
3409 case Decl::TemplateParamObject:
3415 case Decl::CXXMethod:
3420 = dyn_cast<FunctionProtoType>(VD->
getType()))
3428 if (cast<CXXMethodDecl>(VD)->isStatic()) {
3434 case Decl::CXXConversion:
3435 case Decl::CXXDestructor:
3436 case Decl::CXXConstructor:
3449 Target.resize(CharByteWidth * (Source.size() + 1));
3450 char *ResultPtr = &Target[0];
3451 const llvm::UTF8 *ErrorPtr;
3453 llvm::ConvertUTF8toWide(CharByteWidth, Source, ResultPtr, ErrorPtr);
3456 Target.resize(ResultPtr - &Target[0]);
3462 Decl *currentDecl =
nullptr;
3464 currentDecl = BSI->TheDecl;
3466 currentDecl = LSI->CallOperator;
3468 currentDecl = CSI->TheCapturedDecl;
3473 Diag(Loc, diag::ext_predef_outside_function);
3479 if (cast<DeclContext>(currentDecl)->isDependentContext())
3485 unsigned Length = Str.length();
3487 llvm::APInt LengthI(32, Length + 1);
3516 default: llvm_unreachable(
"Unknown simple primary expr!");
3531 bool Invalid =
false;
3562 else if (Literal.
isUTF8())
3578 return ExprError(
Diag(UDSuffixLoc, diag::err_invalid_character_udl));
3596 using llvm::APFloat;
3597 APFloat Val(Format);
3603 if ((result & APFloat::opOverflow) ||
3604 ((result & APFloat::opUnderflow) && Val.isZero())) {
3605 unsigned diagnostic;
3607 if (result & APFloat::opOverflow) {
3608 diagnostic = diag::warn_float_overflow;
3609 APFloat::getLargest(Format).toString(buffer);
3611 diagnostic = diag::warn_float_underflow;
3612 APFloat::getSmallest(Format).toString(buffer);
3615 S.
Diag(Loc, diagnostic)
3617 << StringRef(buffer.data(), buffer.size());
3620 bool isExact = (result == APFloat::opOK);
3625 assert(E &&
"Invalid expression");
3632 Diag(E->
getExprLoc(), diag::err_pragma_loop_invalid_argument_type) << QT;
3636 llvm::APSInt ValueAPS;
3642 bool ValueIsPositive = ValueAPS.isStrictlyPositive();
3643 if (!ValueIsPositive || ValueAPS.getActiveBits() > 31) {
3644 Diag(E->
getExprLoc(), diag::err_pragma_loop_invalid_argument_value)
3645 << ValueAPS.toString(10) << ValueIsPositive;
3668 bool Invalid =
false;
3687 return ExprError(
Diag(UDSuffixLoc, diag::err_invalid_numeric_udl));
3747 false, StrTy, &TokLoc, 1);
3758 bool CharIsUnsigned =
Context.
CharTy->isUnsignedIntegerType();
3759 llvm::APSInt
Value(CharBits, CharIsUnsigned);
3761 Value = TokSpelling[I];
3770 llvm_unreachable(
"unexpected literal operator lookup result");
3782 }
else if (Literal.
isLong) {
3790 }
else if (Literal.
isLong) {
3803 llvm::APInt Val(bit_width, 0, isSigned);
3805 bool ValIsZero = Val.isNullValue() && !Overflowed;
3808 if (Literal.
isFract && Val == MaxVal + 1 && !ValIsZero)
3814 else if (Val.ugt(MaxVal) || Overflowed)
3863 diag::warn_cxx98_compat_longlong : diag::ext_cxx11_longlong);
3870 llvm::APInt ResultVal(MaxWidth, 0);
3878 "long long is not intmax_t?");
3907 if (ResultVal.isIntN(IntSize)) {
3909 if (!Literal.
isUnsigned && ResultVal[IntSize-1] == 0)
3911 else if (AllowUnsigned)
3922 if (ResultVal.isIntN(LongSize)) {
3924 if (!Literal.
isUnsigned && ResultVal[LongSize-1] == 0)
3926 else if (AllowUnsigned)
3931 const unsigned LongLongSize =
3936 ? diag::warn_old_implicitly_unsigned_long_cxx
3938 ext_old_implicitly_unsigned_long_cxx
3939 : diag::warn_old_implicitly_unsigned_long)
3940 << (LongLongSize > LongSize ? 0
3953 if (ResultVal.isIntN(LongLongSize)) {
3957 if (!Literal.
isUnsigned && (ResultVal[LongLongSize-1] == 0 ||
3960 else if (AllowUnsigned)
3962 Width = LongLongSize;
3974 if (ResultVal.getBitWidth() != Width)
3975 ResultVal = ResultVal.trunc(Width);
3991 assert(E &&
"ActOnParenExpr() missing expr");
4002 if (!(T->isArithmeticType() || T->isVoidType() || T->isVectorType())) {
4003 S.
Diag(Loc, diag::err_vecstep_non_scalar_vector_type)
4008 assert((T->isVoidType() || !T->isIncompleteType()) &&
4009 "Scalar types should always be complete");
4022 if (T->isFunctionType() &&
4023 (TraitKind == UETT_SizeOf || TraitKind == UETT_AlignOf ||
4024 TraitKind == UETT_PreferredAlignOf)) {
4026 S.
Diag(Loc, diag::ext_sizeof_alignof_function_type)
4033 if (T->isVoidType()) {
4034 unsigned DiagID = S.
LangOpts.OpenCL ? diag::err_opencl_sizeof_alignof_type
4035 : diag::ext_sizeof_alignof_void_type;
4050 S.
Diag(Loc, diag::err_sizeof_nonfragile_interface)
4051 << T << (TraitKind == UETT_SizeOf)
4069 if (!ICE || ICE->
getCastKind() != CK_ArrayToPointerDecay)
4089 bool IsUnevaluatedOperand =
4090 (ExprKind == UETT_SizeOf || ExprKind == UETT_AlignOf ||
4091 ExprKind == UETT_PreferredAlignOf || ExprKind == UETT_VecStep);
4092 if (IsUnevaluatedOperand) {
4107 Diag(E->
getExprLoc(), diag::warn_side_effects_unevaluated_context);
4109 if (ExprKind == UETT_VecStep)
4122 if (ExprKind == UETT_AlignOf || ExprKind == UETT_PreferredAlignOf) {
4125 diag::err_sizeof_alignof_incomplete_or_sizeless_type,
4130 E, diag::err_sizeof_alignof_incomplete_or_sizeless_type,
4149 if (ExprKind == UETT_SizeOf) {
4151 if (
ParmVarDecl *PVD = dyn_cast<ParmVarDecl>(DeclRef->getFoundDecl())) {
4152 QualType OType = PVD->getOriginalType();
4157 Diag(PVD->getLocation(), diag::note_declared_at);
4210 if (ExprKind == UETT_AlignOf || ExprKind == UETT_PreferredAlignOf ||
4211 ExprKind == UETT_OpenMPRequiredSimdAlign)
4214 if (ExprKind == UETT_VecStep)
4223 OpLoc, ExprType, diag::err_sizeof_alignof_incomplete_or_sizeless_type,
4228 Diag(OpLoc, diag::err_sizeof_alignof_function_type)
4246 S.
Diag(E->
getExprLoc(), diag::err_sizeof_alignof_typeof_bitfield)
4253 if (
DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(Inner)) {
4255 }
else if (
MemberExpr *ME = dyn_cast<MemberExpr>(Inner)) {
4256 D = ME->getMemberDecl();
4276 if (
FieldDecl *FD = dyn_cast_or_null<FieldDecl>(D)) {
4279 if (!FD->getParent()->isCompleteDefinition()) {
4280 S.
Diag(E->
getExprLoc(), diag::err_alignof_member_of_incomplete_type)
4289 if (!FD->getType()->isReferenceType())
4308 assert(T->isVariablyModifiedType());
4309 assert(CSI !=
nullptr);
4313 const Type *Ty = T.getTypePtr();
4315#define TYPE(Class, Base)
4316#define ABSTRACT_TYPE(Class, Base)
4317#define NON_CANONICAL_TYPE(Class, Base)
4318#define DEPENDENT_TYPE(Class, Base) case Type::Class:
4319#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base)
4320#include "clang/AST/TypeNodes.inc"
4327 case Type::ExtVector:
4328 case Type::ConstantMatrix:
4331 case Type::Elaborated:
4332 case Type::TemplateSpecialization:
4333 case Type::ObjCObject:
4334 case Type::ObjCInterface:
4335 case Type::ObjCObjectPointer:
4336 case Type::ObjCTypeParam:
4339 llvm_unreachable(
"type class is never variably-modified!");
4340 case Type::Adjusted:
4349 case Type::BlockPointer:
4352 case Type::LValueReference:
4353 case Type::RValueReference:
4356 case Type::MemberPointer:
4359 case Type::ConstantArray:
4360 case Type::IncompleteArray:
4364 case Type::VariableArray: {
4372 (isa<CapturedRegionScopeInfo>(CSI) || isa<LambdaScopeInfo>(CSI)))
4378 case Type::FunctionProto:
4379 case Type::FunctionNoProto:
4384 case Type::UnaryTransform:
4385 case Type::Attributed:
4386 case Type::SubstTemplateTypeParm:
4387 case Type::MacroQualified:
4389 T = T.getSingleStepDesugaredType(Context);
4394 case Type::Decltype:
4398 case Type::DeducedTemplateSpecialization:
4401 case Type::TypeOfExpr:
4408 }
while (!T.isNull() && T->isVariablyModifiedType());
4422 if (!T->isDependentType() &&
4431 auto *CSI = dyn_cast<CapturingScopeInfo>(*I);
4435 if (
auto *LSI = dyn_cast<LambdaScopeInfo>(CSI))
4436 DC = LSI->CallOperator;
4437 else if (
auto *CRSI = dyn_cast<CapturedRegionScopeInfo>(CSI))
4438 DC = CRSI->TheCapturedDecl;
4439 else if (
auto *BSI = dyn_cast<BlockScopeInfo>(CSI))
4470 }
else if (ExprKind == UETT_AlignOf || ExprKind == UETT_PreferredAlignOf) {
4472 }
else if (ExprKind == UETT_VecStep) {
4474 }
else if (ExprKind == UETT_OpenMPRequiredSimdAlign) {
4478 Diag(E->
getExprLoc(), diag::err_sizeof_alignof_typeof_bitfield) << 0;
4521 if (
V.get()->isTypeDependent())
4533 return CT->getElementType();
4536 if (
V.get()->getType()->isArithmeticType())
4537 return V.get()->getType();
4542 if (PR.
get() !=
V.get()) {
4548 S.
Diag(Loc, diag::err_realimag_invalid_type) <<
V.get()->getType()
4549 << (IsReal ?
"__real" :
"__imag");
4560 default: llvm_unreachable(
"Unknown unary op!");
4561 case tok::plusplus: Opc = UO_PostInc;
break;
4562 case tok::minusminus: Opc = UO_PostDec;
break;
4581 !S.
LangOpts.ObjCSubscriptingLegacyRuntime)
4584 S.
Diag(opLoc, diag::err_arithmetic_nonfragile_interface)
4591 auto *BaseNoParens =
Base->IgnoreParens();
4592 if (
auto *MSProp = dyn_cast<MSPropertyRefExpr>(BaseNoParens))
4593 return MSProp->getPropertyDecl()->getType()->isArrayType();
4607 if (isa<ParenListExpr>(base)) {
4610 base = result.
get();
4617 auto CheckAndReportCommaError = [
this, base, rbLoc](
Expr *E) {
4618 if (isa<BinaryOperator>(E) && cast<BinaryOperator>(E)->isCommaOp()) {
4619 Diag(E->getExprLoc(), diag::err_matrix_subscript_comma)
4628 BuiltinType::IncompleteMatrixIdx) &&
4629 !isa<MatrixSubscriptExpr>(base)) {
4630 Diag(base->
getExprLoc(), diag::err_matrix_separate_incomplete_index)
4636 auto *matSubscriptE = dyn_cast<MatrixSubscriptExpr>(base);
4637 if (matSubscriptE) {
4638 if (CheckAndReportCommaError(idx))
4641 assert(matSubscriptE->isIncomplete() &&
4642 "base has to be an incomplete matrix subscript");
4644 matSubscriptE->getBase(), matSubscriptE->getRowIdx(), idx, rbLoc);
4652 bool IsMSPropertySubscript =
false;
4655 if (!IsMSPropertySubscript) {
4659 base = result.
get();
4665 if (CheckAndReportCommaError(idx))
4673 ((isa<BinaryOperator>(idx) && cast<BinaryOperator>(idx)->isCommaOp()) ||
4674 (isa<CXXOperatorCallExpr>(idx) &&
4675 cast<CXXOperatorCallExpr>(idx)->getOperator() == OO_Comma))) {
4701 if (IsMSPropertySubscript) {
4725 if (!Res.
isInvalid() && isa<ArraySubscriptExpr>(Res.
get()))
4726 CheckSubscriptAccessOfNoDeref(cast<ArraySubscriptExpr>(Res.
get()));
4736 return InitSeq.
Perform(*
this, Entity, Kind, E);
4750 RowIdx = RowR.
get();
4765 ColumnIdx = ColumnR.
get();
4770 auto IsIndexValid = [&](
Expr *IndexExpr,
unsigned Dim,
4771 bool IsColumnIdx) ->
Expr * {
4781 if ((*Idx < 0 || *Idx >= Dim)) {
4783 << IsColumnIdx << Dim;
4791 "should be able to convert any integer type to size type");
4792 return ConvExpr.
get();
4796 RowIdx = IsIndexValid(RowIdx, MTy->getNumRows(),
false);
4797 ColumnIdx = IsIndexValid(ColumnIdx, MTy->getNumColumns(),
true);
4798 if (!RowIdx || !ColumnIdx)
4802 MTy->getElementType(), RBLoc);
4805void Sema::CheckAddressOfNoDeref(
const Expr *E) {
4812 while ((
Member = dyn_cast<MemberExpr>(StrippedExpr)) && !
Member->isArrow())
4815 LastRecord.PossibleDerefs.erase(StrippedExpr);
4826 if (isa<ArrayType>(ResultTy))
4829 if (ResultTy->
hasAttr(attr::NoDeref)) {
4830 LastRecord.PossibleDerefs.insert(E);
4838 if (!(isa<ArrayType>(BaseTy) || isa<PointerType>(BaseTy)))
4843 while ((
Member = dyn_cast<MemberExpr>(
Base->IgnoreParenCasts())) &&
4847 if (
const auto *Ptr = dyn_cast<PointerType>(
Base->getType())) {
4848 if (Ptr->getPointeeType()->hasAttr(attr::NoDeref))
4849 LastRecord.PossibleDerefs.insert(E);
4859 if (
Base->getType()->isPlaceholderType() &&
4860 !
Base->getType()->isSpecificPlaceholderType(
4861 BuiltinType::OMPArraySection)) {
4874 LowerBound =
Result.get();
4896 if (
Base->isTypeDependent() ||
4903 OK_Ordinary, ColonLocFirst, ColonLocSecond, RBLoc);
4915 Diag(
Base->getExprLoc(), diag::err_omp_typecheck_section_value)
4916 <<
Base->getSourceRange());
4922 if (Res.isInvalid())
4924 diag::err_omp_typecheck_section_not_integer)
4926 LowerBound = Res.get();
4936 if (Res.isInvalid())
4938 diag::err_omp_typecheck_section_not_integer)
4952 diag::err_omp_typecheck_section_not_integer)
4967 Diag(
Base->getExprLoc(), diag::err_omp_section_function_type)
4968 << ResultTy <<
Base->getSourceRange();
4973 diag::err_omp_section_incomplete_type,
Base))
4981 llvm::APSInt LowerBoundValue =
Result.Val.getInt();
4982 if (LowerBoundValue.isNegative()) {
4983 Diag(LowerBound->
getExprLoc(), diag::err_omp_section_not_subset_of_array)
4995 llvm::APSInt LengthValue =
Result.Val.getInt();
4996 if (LengthValue.isNegative()) {
4997 Diag(Length->
getExprLoc(), diag::err_omp_section_length_negative)
4998 << LengthValue.toString(10,
true)
5003 }
else if (ColonLocFirst.
isValid() &&
5009 Diag(ColonLocFirst, diag::err_omp_section_length_undefined)
5019 llvm::APSInt StrideValue =
Result.Val.getInt();
5020 if (!StrideValue.isStrictlyPositive()) {
5021 Diag(Stride->
getExprLoc(), diag::err_omp_section_stride_non_positive)
5022 << StrideValue.toString(10,
true)
5029 if (!
Base->getType()->isSpecificPlaceholderType(
5030 BuiltinType::OMPArraySection)) {
5038 OK_Ordinary, ColonLocFirst, ColonLocSecond, RBLoc);
5045 if (
Base->getType()->isPlaceholderType()) {
5059 LParenLoc, RParenLoc, Dims, Brackets);
5061 (!
Base->isTypeDependent() &&
5064 diag::err_omp_non_pointer_type_array_shaping_base)
5065 <<
Base->getSourceRange());
5068 bool ErrorFound =
false;
5069 for (
Expr *Dim : Dims) {
5070 if (Dim->getType()->isPlaceholderType()) {
5072 if (
Result.isInvalid()) {
5077 if (
Result.isInvalid()) {
5083 if (!Dim->isTypeDependent()) {
5086 if (
Result.isInvalid()) {
5088 Diag(Dim->getExprLoc(), diag::err_omp_typecheck_shaping_not_integer)
5089 << Dim->getSourceRange();
5094 if (!Dim->isValueDependent() && Dim->EvaluateAsInt(EvResult,
Context)) {
5099 if (!
Value.isStrictlyPositive()) {
5100 Diag(Dim->getExprLoc(), diag::err_omp_shaping_dimension_not_positive)
5101 <<
Value.toString(10,
true)
5102 << Dim->getSourceRange();
5108 NewDims.push_back(Dim);
5113 LParenLoc, RParenLoc, NewDims, Brackets);
5120 bool IsCorrect =
true;
5125 if (!D.Type.getAsOpaquePtr()) {
5130 StartLoc = D.DeclIdentLoc;
5136 bool IsDeclTyDependent = DeclTy->isDependentType() ||
5137 DeclTy->containsUnexpandedParameterPack() ||
5138 DeclTy->isInstantiationDependentType();
5139 if (!IsDeclTyDependent) {
5140 if (!DeclTy->isIntegralType(
Context) && !DeclTy->isAnyPointerType()) {
5143 Diag(StartLoc, diag::err_omp_iterator_not_integral_or_pointer)
5148 if (DeclTy.isConstant(
Context)) {
5151 Diag(StartLoc, diag::err_omp_iterator_not_integral_or_pointer)
5159 assert(D.DeclIdent &&
"Identifier expected.");
5163 D.DeclIdent, DeclTy, TInfo,
SC_None);
5177 Diag(D.DeclIdentLoc, diag::err_redefinition) << VD->getDeclName();
5186 if (!IsDeclTyDependent &&
Begin && !
Begin->isTypeDependent()) {
5191 Expr *End = D.Range.End;
5192 if (!IsDeclTyDependent && End && !End->isTypeDependent()) {
5196 Expr *Step = D.Range.Step;
5199 Diag(Step->
getExprLoc(), diag::err_omp_iterator_step_not_integral)
5209 Diag(Step->
getExprLoc(), diag::err_omp_iterator_step_constant_zero)
5215 if (!
Begin || !End || !IsCorrect) {
5231 if (
Decl *ID = D.IteratorDecl)
5232 ID->setInvalidDecl();
5275 D.Range.Begin, D.Range.End);
5327 D.IteratorDecl->getBeginLoc(),
nullptr,
5329 CounterVD->setImplicit();
5332 D.IteratorDecl->getBeginLoc());
5338 D.AssignmentLoc, BO_Mul,
5355 cast<VarDecl>(D.IteratorDecl)->getType(),
VK_LValue,
5356 D.IteratorDecl->getBeginLoc());
5371 if (!CounterUpdateRes.
isUsable()) {
5377 if (!CounterUpdateRes.
isUsable()) {
5388 Helpers.assign(ID.size(), {});
5393 if (
Decl *ID = D.IteratorDecl)
5394 ID->setInvalidDecl();
5399 LLoc, RLoc, ID, Helpers);
5414 for (
auto *Op : {LHSExp, RHSExp}) {
5415 Op = Op->IgnoreImplicit();
5416 if (Op->getType()->isArrayType() && !Op->isLValue())
5439 Expr *BaseExpr, *IndexExpr;
5473 Diag(LLoc, diag::err_subscript_nonfragile_interface)
5485 LHSExp = Materialized.
get();
5491 ResultType = VTy->getElementType();
5493 Qualifiers BaseQuals = BaseType.getQualifiers();
5495 Qualifiers Combined = BaseQuals + MemberQuals;
5496 if (Combined != MemberQuals)
5507 CK_ArrayToPointerDecay).
get();
5513 }
else if (RHSTy->isArrayType()) {
5518 CK_ArrayToPointerDecay).
get();
5525 return ExprError(
Diag(LLoc, diag::err_typecheck_subscript_value)
5530 return ExprError(
Diag(LLoc, diag::err_typecheck_subscript_not_integer)
5550 Diag(LLoc, diag::ext_gnu_subscript_void_type)
5559 diag::err_subscript_incomplete_or_sizeless_type, BaseExpr))
5572 auto *CSI = dyn_cast<CapturingScopeInfo>(*I);
5576 if (
auto *LSI = dyn_cast<LambdaScopeInfo>(CSI))
5577 DC = LSI->CallOperator;
5578 else if (
auto *CRSI = dyn_cast<CapturedRegionScopeInfo>(CSI))
5579 DC = CRSI->TheCapturedDecl;
5580 else if (
auto *BSI = dyn_cast<BlockScopeInfo>(CSI))
5598 if (Param->hasUnparsedDefaultArg()) {
5602 Diag(Param->getBeginLoc(), diag::err_recursive_default_argument) << FD;
5603 Diag(CallLoc, diag::note_recursive_default_argument_used_here);
5604 Param->setInvalidDecl();
5608 Diag(CallLoc, diag::err_use_of_default_argument_to_function_declared_later)
5611 diag::note_default_argument_declared_here);
5615 if (Param->hasUninstantiatedDefaultArg() &&
5619 assert(Param->hasInit() &&
"default argument but no initializer?");
5628 if (
auto Init = dyn_cast<ExprWithCleanups>(Param->getInit())) {
5631 Cleanup.setExprNeedsCleanups(Init->cleanupsHaveSideEffects());
5636 assert(!Init->getNumObjects() &&
5637 "default argument expression has capturing blocks?");
5652 assert(Param->hasDefaultArg() &&
"can't build nonexistent default arg");
5662 if (dyn_cast_or_null<CXXConstructorDecl>(FDecl))
5667 if (
CXXMethodDecl *Method = dyn_cast_or_null<CXXMethodDecl>(FDecl))
5668 if (Method->isInstance())
5683 FunctionName(FuncName) {}
5685 bool ValidateCandidate(
const TypoCorrection &candidate)
override {
5694 std::unique_ptr<CorrectionCandidateCallback> clone()
override {
5695 return std::make_unique<FunctionCallCCC>(*
this);
5715 if (
NamedDecl *ND = Corrected.getFoundDecl()) {
5716 if (Corrected.isOverloaded()) {
5726 ND = Best->FoundDecl;
5727 Corrected.setCorrectionDecl(ND);
5733 ND = ND->getUnderlyingDecl();
5734 if (isa<ValueDecl>(ND) || isa<FunctionTemplateDecl>(ND))
5753 bool IsExecConfig) {
5763 bool Invalid =
false;
5772 if (Args.size() < NumParams) {
5773 if (Args.size() < MinArgs) {
5778 ? diag::err_typecheck_call_too_few_args_suggest
5779 : diag::err_typecheck_call_too_few_args_at_least_suggest;
5781 <<
static_cast<unsigned>(Args.size())
5786 ? diag::err_typecheck_call_too_few_args_one
5787 : diag::err_typecheck_call_too_few_args_at_least_one)
5791 ? diag::err_typecheck_call_too_few_args
5792 : diag::err_typecheck_call_too_few_args_at_least)
5793 << FnKind << MinArgs << static_cast<unsigned>(Args.size())
5797 if (!TC && FDecl && !FDecl->
getBuiltinID() && !IsExecConfig)
5804 assert((Call->getNumArgs() == NumParams) &&
5805 "We should have reserved space for the default arguments before!");
5810 if (Args.size() > NumParams) {
5816 ? diag::err_typecheck_call_too_many_args_suggest
5817 : diag::err_typecheck_call_too_many_args_at_most_suggest;
5819 <<
static_cast<unsigned>(Args.size())
5821 }
else if (NumParams == 1 && FDecl &&
5823 Diag(Args[NumParams]->getBeginLoc(),
5824 MinArgs == NumParams
5825 ? diag::err_typecheck_call_too_many_args_one
5826 : diag::err_typecheck_call_too_many_args_at_most_one)
5830 Args.back()->getEndLoc());
5832 Diag(Args[NumParams]->getBeginLoc(),
5833 MinArgs == NumParams
5834 ? diag::err_typecheck_call_too_many_args
5835 : diag::err_typecheck_call_too_many_args_at_most)
5836 << FnKind << NumParams << static_cast<unsigned>(Args.size())
5839 Args.back()->getEndLoc());
5842 if (!TC && FDecl && !FDecl->
getBuiltinID() && !IsExecConfig)
5846 Call->shrinkNumArgs(NumParams);
5857 unsigned TotalNumArgs = AllArgs.size();
5858 for (
unsigned i = 0; i < TotalNumArgs; ++i)
5859 Call->setArg(i, AllArgs[i]);
5869 bool IsListInitialization) {
5871 bool Invalid =
false;
5874 for (
unsigned i = FirstParam; i < NumParams; i++) {
5879 if (ArgIx < Args.size()) {
5880 Arg = Args[ArgIx++];
5883 diag::err_call_incomplete_argument, Arg))
5887 bool CFAudited =
false;
5899 BE->getBlockDecl()->setDoesNotEscape();
5912 Entity,
SourceLocation(), Arg, IsListInitialization, AllowExplicit);
5918 assert(Param &&
"can't use default arguments without a known callee");
5930 CheckArrayAccess(Arg);
5935 AllArgs.push_back(Arg);
5944 for (
Expr *A : Args.slice(ArgIx)) {
5947 Invalid |= arg.isInvalid();
5948 AllArgs.push_back(arg.get());
5953 for (
Expr *A : Args.slice(ArgIx)) {
5956 AllArgs.push_back(Arg.
get());
5961 for (
Expr *A : Args.slice(ArgIx))
5962 CheckArrayAccess(A);
5970 TL = DTL.getOriginalLoc();
5973 << ATL.getLocalSourceRange();
5987 const Expr *ArgExpr) {
5992 QualType OrigTy = Param->getOriginalType();
6017 Diag(CallLoc, diag::warn_static_array_too_small)
6029 if (ArgSize && ParmSize && *ArgSize < *ParmSize) {
6030 Diag(CallLoc, diag::warn_static_array_too_small)
6032 << (
unsigned)ParmSize->getQuantity() << 1;
6045 const BuiltinType *placeholder = dyn_cast<BuiltinType>(type);
6046 if (!placeholder)
return false;
6048 switch (placeholder->
getKind()) {
6050#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
6051 case BuiltinType::Id:
6052#include "clang/Basic/OpenCLImageTypes.def"
6053#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
6054 case BuiltinType::Id:
6055#include "clang/Basic/OpenCLExtensionTypes.def"
6058#define SVE_TYPE(Name, Id, SingletonId) \
6059 case BuiltinType::Id:
6060#include "clang/Basic/AArch64SVEACLETypes.def"
6061#define PPC_VECTOR_TYPE(Name, Id, Size) \
6062 case BuiltinType::Id:
6063#include "clang/Basic/PPCTypes.def"
6064#define PLACEHOLDER_TYPE(ID, SINGLETON_ID)
6065#define BUILTIN_TYPE(ID, SINGLETON_ID) case BuiltinType::ID:
6066#include "clang/AST/BuiltinTypes.def"
6071 case BuiltinType::Overload:
6076 case BuiltinType::ARCUnbridgedCast:
6080 case BuiltinType::PseudoObject:
6085 case BuiltinType::UnknownAny:
6089 case BuiltinType::BoundMember:
6090 case BuiltinType::BuiltinFn:
6091 case BuiltinType::IncompleteMatrixIdx:
6092 case BuiltinType::OMPArraySection:
6093 case BuiltinType::OMPArrayShaping:
6094 case BuiltinType::OMPIterator:
6098 llvm_unreachable(
"bad builtin type kind");
6106 bool hasInvalid =
false;
6107 for (
size_t i = 0, e = args.size(); i != e; i++) {
6110 if (result.
isInvalid()) hasInvalid =
true;
6111 else args[i] = result.
get();
6139 bool NeedsNewDecl =
false;
6152 if (!ParamType->isPointerType() ||
6153 ParamType.hasAddressSpace() ||
6154 !ArgType->isPointerType() ||
6155 !ArgType->getPointeeType().hasAddressSpace()) {
6156 OverloadParams.push_back(ParamType);
6164 NeedsNewDecl =
true;
6165 LangAS AS = ArgType->getPointeeType().getAddressSpace();
6177 OverloadParams, EPI);
6189 for (
unsigned i = 0, e = FT->
getNumParams(); i != e; ++i) {
6196 Params.push_back(Parm);
6198 OverloadDecl->setParams(Params);
6200 return OverloadDecl;
6211 !Callee->isVariadic())
6213 if (Callee->getMinRequiredArguments() > ArgExprs.size())
6219 isa<CXXMethodDecl>(Callee)
6220 ? diag::err_ovl_no_viable_member_function_in_call
6221 : diag::err_ovl_no_viable_function_in_call)
6222 << Callee << Callee->getSourceRange();
6223 S.
Diag(Callee->getLocation(),
6224 diag::note_ovl_candidate_disabled_by_function_cond_attr)
6225 <<
Attr->getCond()->getSourceRange() <<
Attr->getMessage();
6233 const auto GetFunctionLevelDCIfCXXClass =
6241 if (
const auto *MD = dyn_cast<CXXMethodDecl>(DC))
6242 return MD->
getParent()->getCanonicalDecl();
6245 if (
const auto *RD = dyn_cast<CXXRecordDecl>(DC))
6246 return RD->getCanonicalDecl();
6253 const CXXRecordDecl *
const CurParentClass = GetFunctionLevelDCIfCXXClass(S);
6254 if (!CurParentClass)
6261 assert(NamingClass &&
"Must have naming class even for implicit access");
6267 return CurParentClass == NamingClass ||
6317 if (Call.isInvalid())
6322 if (
auto *ULE = dyn_cast<UnresolvedLookupExpr>(Fn)) {
6323 if (ULE->hasExplicitTemplateArgs() &&
6324 ULE->decls_begin() == ULE->decls_end()) {
6326 ? diag::warn_cxx17_compat_adl_only_template_id
6327 : diag::ext_adl_only_template_id)
6344 Expr *ExecConfig,
bool IsExecConfig,
6345 bool AllowRecovery) {
6356 if (isa<CXXPseudoDestructorExpr>(Fn)) {
6357 if (!ArgExprs.empty()) {
6362 ArgExprs.back()->getEndLoc()));
6379 Context, Fn, cast<CallExpr>(ExecConfig), ArgExprs,
6384 *
this, dyn_cast<UnresolvedMemberExpr>(Fn->
IgnoreParens()),
6405 RParenLoc, AllowRecovery);
6421 Scope, Fn, ULE, LParenLoc, ArgExprs, RParenLoc, ExecConfig,
6424 RParenLoc, AllowRecovery);
6437 bool CallingNDeclIndirectly =
false;
6439 if (
UnaryOperator *UnOp = dyn_cast<UnaryOperator>(NakedFn)) {
6440 if (UnOp->getOpcode() == UO_AddrOf) {
6441 CallingNDeclIndirectly =
true;
6446 if (
auto *DRE = dyn_cast<DeclRefExpr>(NakedFn)) {
6447 NDecl = DRE->getDecl();
6460 nullptr, DRE->isNonOdrUse());
6463 }
else if (isa<MemberExpr>(NakedFn))
6466 if (
FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(NDecl)) {
6481 llvm::any_of(ArgExprs,
6482 [](
clang::Expr *E) { return E->containsErrors(); })) &&
6483 "should only occur in error-recovery path.");
6485 llvm::isa_and_nonnull<FunctionDecl>(NDecl)
6493 ExecConfig, IsExecConfig);
6509 diag::err_invalid_astype_of_different_size)
6540 FunctionDecl *FDecl = dyn_cast_or_null<FunctionDecl>(NDecl);
6541 unsigned BuiltinID = (FDecl ? FDecl->
getBuiltinID() : 0);
6557 Diag(Fn->
getExprLoc(), diag::warn_arm_interrupt_calling_convention);
6593 return ExprError(
Diag(LParenLoc, diag::err_typecheck_call_not_function)
6608 return ExprError(
Diag(LParenLoc, diag::err_typecheck_call_not_function)
6616 const auto *Proto = dyn_cast_or_null<FunctionProtoType>(FuncT);
6617 unsigned NumParams = Proto ? Proto->getNumParams() : 0;
6621 assert(UsesADL == ADLCallKind::NotADL &&
6622 "CUDAKernelCallExpr should not use ADL");
6643 TheCall = dyn_cast<CallExpr>(
Result.get());
6644 bool CorrectedTypos = TheCall != TheOldCall;
6645 if (!TheCall)
return Result;
6652 if (CorrectedTypos && Args.size() < NumParams) {
6668 return CheckBuiltinFunctionCall(FDecl, BuiltinID, TheCall);
6674 return ExprError(
Diag(LParenLoc,diag::err_kern_call_not_global_function)
6681 return ExprError(
Diag(LParenLoc, diag::err_kern_type_not_void_return)
6686 return ExprError(
Diag(LParenLoc, diag::err_global_call_not_config)
6705 assert(isa<FunctionNoProtoType>(FuncT) &&
"Unknown FunctionType!");
6713 if (!Proto || !(Proto->isVariadic() && Args.size() >= Def->
param_size()))
6714 Diag(RParenLoc, diag::warn_call_wrong_number_of_arguments)
6725 for (
unsigned i = 0, e = Args.size(); i != e; i++) {
6726 Expr *Arg = Args[i];
6728 if (Proto && i < Proto->getNumParams()) {
6730 Context, Proto->getParamType(i), Proto->isParamConsumed(i));
6748 diag::err_call_incomplete_argument, Arg))
6755 if (
CXXMethodDecl *Method = dyn_cast_or_null<CXXMethodDecl>(FDecl))
6756 if (!Method->isStatic())
6757 return ExprError(
Diag(LParenLoc, diag::err_member_call_without_object)
6766 for (
unsigned i = 0, e = Args.size(); i != e; i++) {
6767 if (
const auto *RT =
6768 dyn_cast<RecordType>(Args[i]->
getType().getCanonicalType())) {
6769 if (RT->getDecl()->isOrContainsUnion())
6770 Diag(Args[i]->getBeginLoc(), diag::warn_cmse_nonsecure_union)
6778 if (CheckFunctionCall(FDecl, TheCall, Proto))
6781 checkFortifiedBuiltinMemoryFunction(FDecl, TheCall);
6784 return CheckBuiltinFunctionCall(FDecl, BuiltinID, TheCall);
6786 if (CheckPointerCall(NDecl, TheCall, Proto))
6789 if (CheckOtherCall(TheCall, Proto))
6799 assert(Ty &&
"ActOnCompoundLiteral(): missing type");
6800 assert(InitExpr &&
"ActOnCompoundLiteral(): missing expression");
6818 diag::err_array_incomplete_or_sizeless_type,
6822 return ExprError(
Diag(LParenLoc, diag::err_variable_object_no_init)
6826 diag::err_typecheck_decl_incomplete_type,
6841 LiteralExpr =
Result.get();
6869 if (
auto ILE = dyn_cast<InitListExpr>(LiteralExpr))
6870 for (
unsigned i = 0, j = ILE->getNumInits(); i != j; i++) {
6871 Expr *Init = ILE->getInit(i);
6876 VK, LiteralExpr, isFileScope);
6888 Diag(LParenLoc, diag::err_compound_literal_with_address_space)
6905 Cleanup.setExprNeedsCleanups(
true);
6924 bool DiagnosedArrayDesignator =
false;
6925 bool DiagnosedNestedDesignator =
false;
6926 bool DiagnosedMixedDesignator =
false;
6930 for (
unsigned I = 0, E = InitArgList.size(); I != E; ++I) {
6931 if (
auto *DIE = dyn_cast<DesignatedInitExpr>(InitArgList[I])) {
6933 FirstDesignator = DIE->getBeginLoc();
6938 if (!DiagnosedNestedDesignator && DIE->size() > 1) {
6939 DiagnosedNestedDesignator =
true;
6940 Diag(DIE->getBeginLoc(), diag::ext_designated_init_nested)
6941 << DIE->getDesignatorsSourceRange();
6944 for (
auto &Desig : DIE->designators()) {
6945 if (!Desig.isFieldDesignator() && !DiagnosedArrayDesignator) {
6946 DiagnosedArrayDesignator =
true;
6947 Diag(Desig.getBeginLoc(), diag::ext_designated_init_array)
6948 << Desig.getSourceRange();
6952 if (!DiagnosedMixedDesignator &&
6953 !isa<DesignatedInitExpr>(InitArgList[0])) {
6954 DiagnosedMixedDesignator =
true;
6955 Diag(DIE->getBeginLoc(), diag::ext_designated_init_mixed)
6956 << DIE->getSourceRange();
6957 Diag(InitArgList[0]->getBeginLoc(), diag::note_designated_init_mixed)
6958 << InitArgList[0]->getSourceRange();
6961 isa<DesignatedInitExpr>(InitArgList[0])) {
6962 DiagnosedMixedDesignator =
true;
6964 Diag(DIE->getBeginLoc(), diag::ext_designated_init_mixed)
6965 << DIE->getSourceRange();
6966 Diag(InitArgList[I]->getBeginLoc(), diag::note_designated_init_mixed)
6967 << InitArgList[I]->getSourceRange();
6971 if (FirstDesignator.
isValid()) {
6975 !DiagnosedNestedDesignator && !DiagnosedMixedDesignator) {
6977 ? diag::warn_cxx17_compat_designated_init
6978 : diag::ext_cxx_designated_init);
6980 Diag(FirstDesignator, diag::ext_designated_init);
6995 for (
unsigned I = 0, E = InitArgList.size(); I != E; ++I) {
6996 if (InitArgList[I]->
getType()->isNonOverloadPlaceholderType()) {
7003 InitArgList[I] = result.
get();
7024 Cleanup.setExprNeedsCleanups(
true);
7031 if (type->isObjCObjectPointerType()) {
7033 }
else if (type->isBlockPointerType()) {
7035 return CK_BlockPointerToObjCPointerCast;
7037 assert(type->isPointerType());
7038 return CK_CPointerToObjCPointerCast;
7055 llvm_unreachable(
"member pointer type in C");
7064 if (SrcAS != DestAS)
7065 return CK_AddressSpaceConversion;
7072 ? CK_BitCast : CK_AnyPointerToBlockPointerCast);
7077 return CK_CPointerToObjCPointerCast;
7079 return CK_BlockPointerToObjCPointerCast;
7081 return CK_PointerToBoolean;
7083 return CK_PointerToIntegral;
7089 llvm_unreachable(
"illegal cast from pointer");
7091 llvm_unreachable(
"Should have returned before this");
7096 return CK_FixedPointCast;
7098 return CK_FixedPointToBoolean;
7100 return CK_FixedPointToIntegral;
7102 return CK_FixedPointToFloating;
7106 diag::err_unimplemented_conversion_with_fixed_point_type)
7108 return CK_IntegralCast;
7113 llvm_unreachable(
"illegal cast to pointer type");
7115 llvm_unreachable(
"Should have returned before this");
7125 return CK_NullToPointer;
7126 return CK_IntegralToPointer;
7128 return CK_IntegralToBoolean;
7130 return CK_IntegralCast;
7132 return CK_IntegralToFloating;
7137 return CK_IntegralRealToComplex;
7141 CK_IntegralToFloating);
7142 return CK_FloatingRealToComplex;
7144 llvm_unreachable(
"member pointer type in C");
7146 return CK_IntegralToFixedPoint;
7148 llvm_unreachable(
"Should have returned before this");
7153 return CK_FloatingCast;
7155 return CK_FloatingToBoolean;
7157 return CK_FloatingToIntegral;
7162 return CK_FloatingRealToComplex;
7166 CK_FloatingToIntegral);
7167 return CK_IntegralRealToComplex;
7171 llvm_unreachable(
"valid float->pointer cast?");
7173 llvm_unreachable(
"member pointer type in C");
7175 return CK_FloatingToFixedPoint;
7177 llvm_unreachable(
"Should have returned before this");
7182 return CK_FloatingComplexCast;
7184 return CK_FloatingComplexToIntegralComplex;
7188 return CK_FloatingComplexToReal;
7190 return CK_FloatingCast;
7193 return CK_FloatingComplexToBoolean;
7197 CK_FloatingComplexToReal);
7198 return CK_FloatingToIntegral;
7202 llvm_unreachable(
"valid complex float->pointer cast?");
7204 llvm_unreachable(
"member pointer type in C");
7207 diag::err_unimplemented_conversion_with_fixed_point_type)
7209 return CK_IntegralCast;
7211 llvm_unreachable(
"Should have returned before this");
7216 return CK_IntegralComplexToFloatingComplex;
7218 return CK_IntegralComplexCast;
7222 return CK_IntegralComplexToReal;
7224 return CK_IntegralCast;
7227 return CK_IntegralComplexToBoolean;
7231 CK_IntegralComplexToReal);
7232 return CK_IntegralToFloating;
7236 llvm_unreachable(
"valid complex int->pointer cast?");
7238 llvm_unreachable(
"member pointer type in C");
7241 diag::err_unimplemented_conversion_with_fixed_point_type)
7243 return CK_IntegralCast;
7245 llvm_unreachable(
"Should have returned before this");
7248 llvm_unreachable(
"Unhandled scalar cast");
7255 len = vecType->getNumElements();
7256 eltType = vecType->getElementType();
7263 if (!type->isRealType())
return false;
7279 auto ValidScalableConversion = [](
QualType FirstType,
QualType SecondType) {
7283 const auto *VecTy = SecondType->getAs<
VectorType>();
7288 return ValidScalableConversion(srcTy, destTy) ||
7289 ValidScalableConversion(destTy, srcTy);
7310 uint64_t srcLen, destLen;
7321 return (srcLen * srcEltSize == destLen * destEltSize);
7336 if (!Vec || !Vec->getElementType()->isIntegralOrEnumerationType())
7341 if (!Vec || !Vec->getElementType()->isIntegralOrEnumerationType())
7356 assert(VectorTy->
isVectorType() &&
"Not a vector type!");
7362 diag::err_invalid_conversion_between_vectors :
7363 diag::err_invalid_conversion_between_vector_and_integer)
7364 << VectorTy << Ty << R;
7367 diag::err_invalid_conversion_between_vector_and_scalar)
7368 << VectorTy << Ty << R;
7377 if (DestElemTy == SplattedExpr->
getType())
7378 return SplattedExpr;
7391 CK_BooleanToSignedIntegral);
7392 SplattedExpr = CastExprRes.
get();
7393 CK = CK_IntegralToFloating;
7395 CK = CK_BooleanToSignedIntegral;
7402 SplattedExpr = CastExprRes.
get();
7421 Diag(R.
getBegin(),diag::err_invalid_conversion_between_ext_vectors)
7422 << DestTy << SrcTy << R;
7434 diag::err_invalid_conversion_between_vector_and_scalar)
7435 << DestTy << SrcTy << R;
7437 Kind = CK_VectorSplat;
7446 "ActOnCastExpr(): missing type or expr");
7468 bool isVectorLiteral =
false;
7483 isVectorLiteral =
true;
7486 isVectorLiteral =
true;
7491 if (isVectorLiteral)
7497 if (isa<ParenListExpr>(
CastExpr)) {
7519 assert((isa<ParenListExpr>(E) || isa<ParenExpr>(E)) &&
7520 "Expected paren or paren list expression");
7527 LiteralLParenLoc = PE->getLParenLoc();
7528 LiteralRParenLoc = PE->getRParenLoc();
7529 exprs = PE->getExprs();
7530 numExprs = PE->getNumExprs();
7554 if (numExprs == 1) {
7563 else if (numExprs < numElems) {
7565 diag::err_incorrect_number_of_vector_initializers);
7569 initExprs.append(exprs, exprs + numExprs);
7586 initExprs.append(exprs, exprs + numExprs);
7591 initExprs, LiteralRParenLoc);
7626 Expr *NullExpr = LHSExpr;
7627 Expr *NonPointerExpr = RHSExpr;
7634 NonPointerExpr = LHSExpr;
7656 Diag(QuestionLoc, diag::err_typecheck_cond_incompatible_operands_null)
7657 << NonPointerExpr->
getType() << DiagType
7668 S.
Diag(QuestionLoc, diag::err_typecheck_cond_expect_nonfloat)
7676 S.
Diag(QuestionLoc, diag::err_typecheck_cond_expect_scalar)
7727 bool IsBlockPointer =
false;
7731 IsBlockPointer =
true;
7756 ResultAddrSpace = LAddrSpace;
7758 ResultAddrSpace = RAddrSpace;
7760 S.
Diag(Loc, diag::err_typecheck_op_on_nonoverlapping_address_space_pointers)
7767 auto LHSCastKind = CK_BitCast, RHSCastKind = CK_BitCast;
7782 LAddrSpace == ResultAddrSpace ? CK_BitCast : CK_AddressSpaceConversion;
7784 RAddrSpace == ResultAddrSpace ? CK_BitCast : CK_AddressSpaceConversion;
7793 if (CompositeTy.
isNull()) {
7810 S.
Diag(Loc, diag::ext_typecheck_cond_incompatible_pointers)
7821 QualType ResultTy = [&, ResultAddrSpace]() {
7856 S.
Diag(Loc, diag::err_typecheck_cond_incompatible_operands)
7909 bool IsIntFirstExpr) {
7914 Expr *Expr1 = IsIntFirstExpr ? Int.
get() : PointerExpr;
7915 Expr *Expr2 = IsIntFirstExpr ? PointerExpr : Int.
get();
7917 S.
Diag(Loc, diag::ext_typecheck_cond_pointer_integer_mismatch)
7921 CK_IntegralToPointer);
7955 S.
Diag(QuestionLoc, diag::err_typecheck_cond_expect_int_float)
7961 S.
Diag(QuestionLoc, diag::err_typecheck_cond_expect_int_float)
7967 if (LHSType == RHSType)
7977 (S, LHS, RHS, LHSType, RHSType,
false);
8011 llvm::raw_svector_ostream OS(Str);
8012 OS <<
"(vector of " << NumElements <<
" '" << EleTyName <<
"' values)";
8013 S.
Diag(QuestionLoc, diag::err_conditional_vector_element_size)
8014 << CondTy << OS.str();
8035 S.
Diag(QuestionLoc, diag::err_typecheck_cond_expect_nonfloat)
8053 S.
Diag(QuestionLoc, diag::err_conditional_vector_size)
8054 << CondTy << VecResTy;
8059 QualType RVE = RV->getElementType();
8062 S.
Diag(QuestionLoc, diag::err_conditional_vector_element_size)
8063 << CondTy << VecResTy;
8107 if (
const CallExpr *CE = dyn_cast<CallExpr>(E)) {
8108 QualType Ty = CE->getCallee()->getType();
8146 "should only occur in error-recovery path.");
8182 diag::err_typecheck_cond_incompatible_operands) << LHSTy << RHSTy
8200 Diag(QuestionLoc, diag::err_typecheck_cond_incompatible_operands)
8221 if (LHSRT->getDecl() == RHSRT->getDecl())
8244 if (!compositeType.
isNull())
8245 return compositeType;
8279 Diag(QuestionLoc, diag::err_typecheck_cond_incompatible_operands)
8351 if (!(compositeType =
8355 compositeType = RHSOPT->isObjCBuiltinType() ? RHSTy : LHSTy;
8359 RHSOPT->isObjCQualifiedIdType()) &&
8370 Diag(QuestionLoc, diag::ext_typecheck_cond_incompatible_operands)
8381 return compositeType;
8388 Diag(QuestionLoc, diag::err_cond_voidptr_arc) << LHSTy << RHSTy
8408 Diag(QuestionLoc, diag::err_cond_voidptr_arc) << LHSTy << RHSTy
8440 Self.
Diag(Loc,
Note) << ParenRange;
8465 if (
auto *MTE = dyn_cast<MaterializeTemporaryExpr>(E)) {
8466 E = MTE->getSubExpr();
8473 *Opcode = OP->getOpcode();
8474 *RHSExprs = OP->getRHS();
8481 if (Call->getNumArgs() != 2)
8487 if (OO < OO_Plus || OO > OO_Arrow ||
8488 OO == OO_PlusPlus || OO == OO_MinusMinus)
8494 *RHSExprs = Call->getArg(1);
8511 return OP->isComparisonOp() || OP->isLogicalOp();
8513 return OP->getOpcode() == UO_LNot;
8543 ? diag::warn_precedence_bitwise_conditional
8544 : diag::warn_precedence_conditional;
8546 Self.
Diag(OpLoc, DiagID)
8552 Self.
PDiag(diag::note_precedence_silence)
8557 Self.
PDiag(diag::note_precedence_conditional_first),
8568 auto GetNullability = [&Ctx](
QualType Ty) {
8579 auto LHSKind = GetNullability(LHSTy), RHSKind = GetNullability(RHSTy);
8587 MergedKind = RHSKind;
8594 MergedKind = RHSKind;
8596 MergedKind = LHSKind;
8602 if (GetNullability(ResTy) == MergedKind)
8639 CondExpr = CondResult.
get();
8640 LHSExpr = LHSResult.
get();
8641 RHSExpr = RHSResult.
get();
8647 Expr *commonExpr =
nullptr;
8649 commonExpr = CondExpr;
8656 commonExpr = result.
get();
8670 commonExpr = commonRes.
get();
8680 commonExpr = MatExpr.
get();
8688 LHSExpr = CondExpr = opaqueValue;
8694 ExprResult Cond = CondExpr, LHS = LHSExpr, RHS = RHSExpr;
8696 VK, OK, QuestionLoc);
8704 CheckBoolLikeConversion(Cond.
get(), QuestionLoc);
8712 RHS.get(), result, VK, OK);
8715 commonExpr, opaqueValue, Cond.
get(), LHS.get(), RHS.get(), QuestionLoc,
8716 ColonLoc, result, VK, OK);
8724 if (
const auto *ToFn =
8726 if (
const auto *FromFn =
8744 assert(LHSType.
isCanonical() &&
"LHS not canonicalized!");
8745 assert(RHSType.
isCanonical() &&
"RHS not canonicalized!");
8748 const Type *lhptee, *rhptee;
8750 std::tie(lhptee, lhq) =
8752 std::tie(rhptee, rhq) =
8829 if (ltrans == rtrans) {
8843 if (isa<PointerType>(lhptee) && isa<PointerType>(rhptee)) {
8845 std::tie(lhptee, lhq) =
8847 std::tie(rhptee, rhq) =
8861 }
while (isa<PointerType>(lhptee) && isa<PointerType>(rhptee));
8863 if (lhptee == rhptee)
8887 assert(LHSType.
isCanonical() &&
"LHS not canonicalized!");
8888 assert(RHSType.
isCanonical() &&
"RHS not canonicalized!");
8909 if (LQuals != RQuals)
8938 assert(LHSType.
isCanonical() &&
"LHS was not canonicalized!");
8939 assert(RHSType.
isCanonical() &&
"RHS was not canonicalized!");
8987 return VT->getElementType().getCanonicalType() == ElementType;
9020 if (LHSType == RHSType) {
9027 if (
const AtomicType *AtomicTy = dyn_cast<AtomicType>(LHSType)) {
9032 if (Kind != CK_NoOp && ConvertRHS)
9034 Kind = CK_NonAtomicToAtomic;
9047 Kind = CK_LValueBitCast;
9062 Kind = CK_VectorSplat;
9133 if (
const PointerType *LHSPointer = dyn_cast<PointerType>(LHSType)) {
9135 if (isa<PointerType>(RHSType)) {
9136 LangAS AddrSpaceL = LHSPointer->getPointeeType().getAddressSpace();
9138 if (AddrSpaceL != AddrSpaceR)
9139 Kind = CK_AddressSpaceConversion;
9149 Kind = CK_IntegralToPointer;
9155 if (isa<ObjCObjectPointerType>(RHSType)) {
9157 if (LHSPointer->getPointeeType()->isVoidType()) {
9176 if (LHSPointer->getPointeeType()->isVoidType()) {
9177 LangAS AddrSpaceL = LHSPointer->getPointeeType().getAddressSpace();
9182 AddrSpaceL != AddrSpaceR ? CK_AddressSpaceConversion : CK_BitCast;
9191 if (isa<BlockPointerType>(LHSType)) {
9200 Kind = AddrSpaceL != AddrSpaceR ? CK_AddressSpaceConversion : CK_BitCast;
9206 Kind = CK_IntegralToPointer;
9212 Kind = CK_AnyPointerToBlockPointerCast;
9218 if (RHSPT->getPointeeType()->isVoidType()) {
9219 Kind = CK_AnyPointerToBlockPointerCast;
9227 if (isa<ObjCObjectPointerType>(LHSType)) {
9233 if (
getLangOpts().allowsNonTrivialObjCLifetimeQualifiers() &&
9242 Kind = CK_IntegralToPointer;
9248 if (isa<PointerType>(RHSType)) {
9249 Kind = CK_CPointerToObjCPointerCast;
9271 Kind = CK_BlockPointerToObjCPointerCast;
9279 if (isa<PointerType>(RHSType)) {
9282 Kind = CK_PointerToBoolean;
9288 Kind = CK_PointerToIntegral;
9296 if (isa<ObjCObjectPointerType>(RHSType)) {
9299 Kind = CK_PointerToBoolean;
9305 Kind = CK_PointerToIntegral;
9313 if (isa<TagType>(LHSType) && isa<TagType>(RHSType)) {
9321 Kind = CK_IntToOCLSampler;
9363 for (
auto *it : UD->
fields()) {
9364 if (it->getType()->isPointerType()) {
9403 bool DiagnoseCFAudited,
9407 assert((ConvertRHS || !
Diagnose) &&
"can't indicate whether we diagnosed");
9413 ExprResult &RHS = ConvertRHS ? CallerRHS : LocalRHS;
9417 if (RHSPtrType->getPointeeType()->hasAttr(attr::NoDeref) &&
9418 !LHSPtrType->getPointeeType()->hasAttr(attr::NoDeref)) {
9420 diag::warn_noderef_to_dereferenceable_pointer)
9439 AllowedExplicit::None,
9451 if (
getLangOpts().allowsNonTrivialObjCLifetimeQualifiers() &&
9466 RHS.
get(), LHSType,
false, DAP))
9525 if (
getLangOpts().allowsNonTrivialObjCLifetimeQualifiers() &&
9554struct OriginalOperand {
9555 explicit OriginalOperand(
Expr *Op) : Orig(Op), Conversion(nullptr) {
9556 if (
auto *MTE = dyn_cast<MaterializeTemporaryExpr>(Op))
9557 Op = MTE->getSubExpr();
9558 if (
auto *BTE = dyn_cast<CXXBindTemporaryExpr>(Op))
9559 Op = BTE->getSubExpr();
9560 if (
auto *ICE = dyn_cast<ImplicitCastExpr>(Op)) {
9561 Orig = ICE->getSubExprAsWritten();
9562 Conversion = ICE->getConversionFunction();
9575 OriginalOperand OrigLHS(LHS.
get()), OrigRHS(RHS.
get());
9577 Diag(Loc, diag::err_typecheck_invalid_operands)
9578 << OrigLHS.getType() << OrigRHS.getType()
9583 if (OrigLHS.Conversion) {
9584 Diag(OrigLHS.Conversion->getLocation(),
9585 diag::note_typecheck_invalid_operands_converted)
9588 if (OrigRHS.Conversion) {
9590 diag::note_typecheck_invalid_operands_converted)
9608 if (!(LHSNatVec && RHSNatVec)) {
9609 Expr *Vector = LHSNatVec ? LHS.
get() : RHS.
get();
9610 Expr *NonVector = !LHSNatVec ? LHS.
get() : RHS.
get();
9611 Diag(Loc, diag::err_typecheck_logical_vector_expr_gnu_cpp_restrict)
9617 Diag(Loc, diag::err_typecheck_logical_vector_expr_gnu_cpp_restrict)
9649 DiagID = diag::err_opencl_scalar_type_rank_greater_than_vector_type;
9654 scalarCast = CK_IntegralCast;
9659 DiagID = diag::err_opencl_scalar_type_rank_greater_than_vector_type;
9662 scalarCast = CK_FloatingCast;
9665 scalarCast = CK_IntegralToFloating;
9674 if (scalarCast != CK_NoOp)
9685 assert(VecTy &&
"Expression E must be a vector");
9687 VecTy->getNumElements(),
9688 VecTy->getVectorKind());
9692 if (
auto *ICE = dyn_cast<ImplicitCastExpr>(E))
9693 if (ICE->getSubExpr()->getType() == NewVecTy)
9694 return ICE->getSubExpr();
9696 auto Cast = ElementType->
isIntegerType() ? CK_IntegralCast : CK_FloatingCast;
9719 unsigned NumBits = IntSigned
9721 :
Result.getActiveBits())
9722 :
Result.getActiveBits();
9729 return (IntSigned != OtherIntSigned &&
9759 llvm::APFloat::rmTowardZero);
9762 bool Ignored =
false;
9763 Float.convertToInteger(ConvertBack, llvm::APFloat::rmNearestTiesToEven,
9765 if (
Result != ConvertBack)
9771 unsigned FloatPrec = llvm::APFloat::semanticsPrecision(
9773 if (Bits > FloatPrec)
9790 assert(!isa<ExtVectorType>(VT) &&
9791 "ExtVectorTypes should not be handled here!");
9818 ScalarCast = CK_IntegralCast;
9822 ScalarCast = CK_FloatingToIntegral;
9830 llvm::APFloat
Result(0.0);
9839 if (!CstScalar && Order < 0)
9845 bool Truncated =
false;
9847 llvm::APFloat::rmNearestTiesToEven, &Truncated);
9852 ScalarCast = CK_FloatingCast;
9857 ScalarCast = CK_IntegralToFloating;
9865 if (ScalarCast != CK_NoOp)
9875 bool AllowBoolConversions) {
9876 if (!IsCompAssign) {
9892 assert(LHSVecType || RHSVecType);
9895 (RHSVecType && RHSVecType->getElementType()->isBFloat16Type()))
9900 if (!AllowBothBool &&
9910 if (LHSVecType && RHSVecType &&
9912 if (isa<ExtVectorType>(LHSVecType)) {
9925 if (AllowBoolConversions && LHSVecType && RHSVecType &&
9935 if (!IsCompAssign &&
9938 RHSVecType->getElementType()->isIntegerType()) {
9954 if (IsSveConversion(LHSType, RHSType) || IsSveConversion(RHSType, LHSType)) {
9955 Diag(Loc, diag::err_typecheck_sve_ambiguous) << LHSType << RHSType;
9965 if (FirstVecType && SecondVecType)
9967 (SecondVecType->getVectorKind() ==
9969 SecondVecType->getVectorKind() ==
9976 if (IsSveGnuConversion(LHSType, RHSType) ||
9977 IsSveGnuConversion(RHSType, LHSType)) {
9978 Diag(Loc, diag::err_typecheck_sve_gnu_ambiguous) << LHSType << RHSType;
9984 unsigned DiagID = diag::err_typecheck_vector_not_convertable;
9986 if (isa<ExtVectorType>(LHSVecType)) {
9997 if (isa<ExtVectorType>(RHSVecType)) {
9999 LHSType, RHSVecType->getElementType(),
10012 QualType VecType = LHSVecType ? LHSType : RHSType;
10013 const VectorType *VT = LHSVecType ? LHSVecType : RHSVecType;
10014 QualType OtherType = LHSVecType ? RHSType : LHSType;
10015 ExprResult *OtherExpr = LHSVecType ? &RHS : &LHS;
10020 if (!IsCompAssign) {
10039 if ((!RHSVecType && !RHSType->
isRealType()) ||
10041 Diag(Loc, diag::err_typecheck_vector_not_convertable_non_scalar)
10042 << LHSType << RHSType
10052 RHSVecType && isa<ExtVectorType>(RHSVecType) &&
10053 LHSVecType && isa<ExtVectorType>(LHSVecType)) {
10054 Diag(Loc, diag::err_opencl_implicit_vector_conversion) << LHSType
10063 if ((RHSVecType && !isa<ExtVectorType>(RHSVecType)) ||
10064 (LHSVecType && !isa<ExtVectorType>(LHSVecType))) {
10065 QualType Scalar = LHSVecType ? RHSType : LHSType;
10066 QualType Vector = LHSVecType ? LHSType : RHSType;
10067 unsigned ScalarOrVector = LHSVecType && RHSVecType ? 1 : 0;
10069 diag::err_typecheck_vector_not_convertable_implict_truncation)
10070 << ScalarOrVector << Scalar << Vector;
10077 << LHSType << RHSType
10104 S.
Diag(Loc, diag::warn_null_in_arithmetic_operation)
10116 S.
Diag(Loc, diag::warn_null_in_comparison_operation)
10117 << LHSNull << NonNullType
10123 const auto *LUE = dyn_cast<UnaryExprOrTypeTraitExpr>(LHS);
10124 const auto *RUE = dyn_cast<UnaryExprOrTypeTraitExpr>(RHS);
10127 if (LUE->getKind() != UETT_SizeOf || LUE->isArgumentType() ||
10128 RUE->getKind() != UETT_SizeOf)
10135 if (RUE->isArgumentType())
10136 RHSTy = RUE->getArgumentType().getNonReferenceType();
10138 RHSTy = RUE->getArgumentExpr()->IgnoreParens()->getType();
10145 if (
const auto *DRE = dyn_cast<DeclRefExpr>(LHSArg)) {
10146 if (
const ValueDecl *LHSArgDecl = DRE->getDecl())
10147 S.
Diag(LHSArgDecl->getLocation(), diag::note_pointer_declared_here)
10151 QualType ArrayElemTy = ArrayTy->getElementType();
10157 S.
Diag(Loc, diag::warn_division_sizeof_array)
10159 if (
const auto *DRE = dyn_cast<DeclRefExpr>(LHSArg)) {
10160 if (
const ValueDecl *LHSArgDecl = DRE->getDecl())
10161 S.
Diag(LHSArgDecl->getLocation(), diag::note_array_declared_here)
10165 S.
Diag(Loc, diag::note_precedence_silence) << RHS;
10178 S.
PDiag(diag::warn_remainder_division_by_zero)
10184 bool IsCompAssign,
bool IsDiv) {
10240 ? diag::err_typecheck_pointer_arith_void_type
10241 : diag::ext_gnu_void_ptr)
10250 ? diag::err_typecheck_pointer_arith_void_type
10251 : diag::ext_gnu_void_ptr)
10252 << 0 <<
Pointer->getSourceRange();
10263 S.
Diag(Loc, diag::warn_gnu_null_ptr_arith)
10264 <<
Pointer->getSourceRange();
10266 S.
Diag(Loc, diag::warn_pointer_arith_null_ptr)
10276 ? diag::err_typecheck_pointer_arith_function_type
10277 : diag::ext_gnu_ptr_func_arith)
10289 assert(
Pointer->getType()->isAnyPointerType());
10291 ? diag::err_typecheck_pointer_arith_function_type
10292 : diag::ext_gnu_ptr_func_arith)
10293 << 0 <<
Pointer->getType()->getPointeeType()
10295 <<
Pointer->getSourceRange();
10303 QualType ResType = Operand->getType();
10305 ResType = ResAtomicType->getValueType();
10311 diag::err_typecheck_arithmetic_incomplete_or_sizeless_type,
10312 Operand->getSourceRange());
10325 QualType ResType = Operand->getType();
10327 ResType = ResAtomicType->getValueType();
10359 if (!isLHSPointer && !isRHSPointer)
return true;
10361 QualType LHSPointeeTy, RHSPointeeTy;
10366 if (isLHSPointer && isRHSPointer) {
10369 diag::err_typecheck_op_on_nonoverlapping_address_space_pointers)
10377 bool isLHSVoidPtr = isLHSPointer && LHSPointeeTy->
isVoidType();
10378 bool isRHSVoidPtr = isRHSPointer && RHSPointeeTy->
isVoidType();
10379 if (isLHSVoidPtr || isRHSVoidPtr) {
10387 bool isLHSFuncPtr = isLHSPointer && LHSPointeeTy->
isFunctionType();
10388 bool isRHSFuncPtr = isRHSPointer && RHSPointeeTy->
isFunctionType();
10389 if (isLHSFuncPtr || isRHSFuncPtr) {
10411 Expr* IndexExpr = RHSExpr;
10414 IndexExpr = LHSExpr;
10417 bool IsStringPlusInt = StrExpr &&
10423 Self.
Diag(OpLoc, diag::warn_string_plus_int)
10427 if (IndexExpr == RHSExpr) {
10429 Self.
Diag(OpLoc, diag::note_string_plus_scalar_silence)
10434 Self.
Diag(OpLoc, diag::note_string_plus_scalar_silence);
10440 const Expr *StringRefExpr = LHSExpr;
10445 CharExpr = dyn_cast<CharacterLiteral>(LHSExpr->
IgnoreImpCasts());
10446 StringRefExpr = RHSExpr;
10449 if (!CharExpr || !StringRefExpr)
10469 Self.
Diag(OpLoc, diag::warn_string_plus_char)
10470 << DiagRange << Ctx.
CharTy;
10472 Self.
Diag(OpLoc, diag::warn_string_plus_char)
10473 << DiagRange << CharExpr->
getType();
10479 Self.
Diag(OpLoc, diag::note_string_plus_scalar_silence)
10484 Self.
Diag(OpLoc, diag::note_string_plus_scalar_silence);
10493 S.
Diag(Loc, diag::err_typecheck_sub_ptr_compatible)
10507 LHS, RHS, Loc, CompLHSTy,
10510 if (CompLHSTy) *CompLHSTy = compType;
10525 if (Opc == BO_Add) {
10532 if (CompLHSTy) *CompLHSTy = compType;
10540 bool isObjCPointer;
10542 isObjCPointer =
false;
10544 isObjCPointer =
true;
10546 std::swap(PExp, IExp);
10548 isObjCPointer =
false;
10550 isObjCPointer =
true;
10557 if (!IExp->getType()->isIntegerType())
10566 (!IExp->isValueDependent() &&
10567 (!IExp->EvaluateAsInt(KnownVal,
Context) ||
10571 Context, BO_Add, PExp, IExp);
10583 CheckArrayAccess(PExp, IExp);
10592 *CompLHSTy = LHSTy;
10607 LHS, RHS, Loc, CompLHSTy,
10610 if (CompLHSTy) *CompLHSTy = compType;
10628 if (CompLHSTy) *CompLHSTy = compType;
10662 CheckArrayAccess(LHS.
get(), RHS.
get(),
nullptr,
10665 if (CompLHSTy) *CompLHSTy = LHS.
get()->
getType();
10700 if (ElementSize.
isZero()) {
10701 Diag(Loc,diag::warn_sub_ptr_zero_size_types)
10707 if (CompLHSTy) *CompLHSTy = LHS.
get()->
getType();
10717 return ET->getDecl()->isScoped();
10734 llvm::APSInt Right = RHSResult.
Val.
getInt();
10736 if (Right.isNegative()) {
10738 S.
PDiag(diag::warn_shift_negative)
10749 LeftSize = FXSema.getWidth() - (
unsigned)FXSema.hasUnsignedPadding();
10751 llvm::APInt LeftBits(Right.getBitWidth(), LeftSize);
10752 if (Right.uge(LeftBits)) {
10754 S.
PDiag(diag::warn_shift_gt_typewidth)
10774 llvm::APSInt Left = LHSResult.
Val.
getInt();
10781 S.
PDiag(diag::warn_shift_lhs_negative)
10786 llvm::APInt ResultBits =
10787 static_cast<llvm::APInt&
>(Right) + Left.getMinSignedBits();
10788 if (LeftBits.uge(ResultBits))
10790 llvm::APSInt
Result = Left.extend(ResultBits.getLimitedValue());
10796 Result.toString(HexResult, 16,
false,
true);
10802 if (LeftBits == ResultBits - 1) {
10803 S.
Diag(Loc, diag::warn_shift_result_sets_sign_bit)
10804 << HexResult << LHSType
10809 S.
Diag(Loc, diag::warn_shift_result_gt_typewidth)
10810 << HexResult.str() <<
Result.getMinSignedBits() << LHSType
10822 S.
Diag(Loc, diag::err_shift_rhs_only_vector)
10828 if (!IsCompAssign) {
10848 if (!LHSEleType->isIntegerType()) {
10849 S.
Diag(Loc, diag::err_typecheck_expect_int)
10854 if (!RHSEleType->isIntegerType()) {
10855 S.
Diag(Loc, diag::err_typecheck_expect_int)
10864 if (LHSEleType != RHSEleType) {
10866 LHSEleType = RHSEleType;
10872 }
else if (RHSVecTy) {
10877 S.
Diag(Loc, diag::err_typecheck_vector_lengths_not_equal)
10885 if (LHSBT != RHSBT &&
10887 S.
Diag(Loc, diag::warn_typecheck_vector_element_sizes_not_equal)
10905 bool IsCompAssign) {
10935 if (IsCompAssign) LHS = OldLHS;
10967 S.
Diag(Loc, IsError ? diag::err_typecheck_comparison_of_distinct_pointers
10968 : diag::ext_typecheck_comparison_of_distinct_pointers)
11008 S.
Diag(Loc, IsError ? diag::err_typecheck_comparison_of_fptr_to_void
11009 : diag::ext_typecheck_comparison_of_fptr_to_void)
11016 case Stmt::ObjCArrayLiteralClass:
11017 case Stmt::ObjCDictionaryLiteralClass:
11018 case Stmt::ObjCStringLiteralClass:
11019 case Stmt::ObjCBoxedExprClass:
11062 QualType T = Method->parameters()[0]->getType();
11063 if (!T->isObjCObjectPointerType())
11066 QualType R = Method->getReturnType();
11078 case Stmt::ObjCStringLiteralClass:
11081 case Stmt::ObjCArrayLiteralClass:
11084 case Stmt::ObjCDictionaryLiteralClass:
11087 case Stmt::BlockExprClass:
11089 case Stmt::ObjCBoxedExprClass: {
11091 switch (Inner->getStmtClass()) {
11092 case Stmt::IntegerLiteralClass:
11093 case Stmt::FloatingLiteralClass:
11094 case Stmt::CharacterLiteralClass:
11095 case Stmt::ObjCBoolLiteralExprClass:
11096 case Stmt::CXXBoolLiteralExprClass:
11099 case Stmt::ImplicitCastExprClass: {
11102 if (CK == CK_IntegralToBoolean || CK == CK_IntegralCast)
11121 Literal = LHS.
get();
11124 Literal = RHS.
get();
11140 llvm_unreachable(
"Unknown Objective-C object literal kind");
11144 S.
Diag(Loc, diag::warn_objc_string_literal_comparison)
11147 S.
Diag(Loc, diag::warn_objc_literal_comparison)
11157 S.
Diag(Loc, diag::note_objc_literal_comparison_isequal)
11170 if (!UO || UO->
getOpcode() != UO_LNot)
return;
11180 bool IsBitwiseOp = Opc == BO_And || Opc == BO_Or || Opc == BO_Xor;
11182 << Loc << IsBitwiseOp;
11209 if (
const DeclRefExpr *DR = dyn_cast<DeclRefExpr>(E)) {
11211 }
else if (
const MemberExpr *Mem = dyn_cast<MemberExpr>(E)) {
11212 if (Mem->isImplicitAccess())
11213 D = Mem->getMemberDecl();
11263 S.
Diag(Loc, diag::warn_depr_array_comparison)
11289 Result = AlwaysConstant;
11293 S.
PDiag(diag::warn_comparison_always)
11308 Result = AlwaysConstant;
11312 S.
PDiag(diag::warn_comparison_always)
11318 if (isa<CastExpr>(LHSStripped))
11320 if (isa<CastExpr>(RHSStripped))
11325 Expr *LiteralString =
nullptr;
11326 Expr *LiteralStringStripped =
nullptr;
11327 if ((isa<StringLiteral>(LHSStripped) || isa<ObjCEncodeExpr>(LHSStripped)) &&
11330 LiteralString = LHS;
11331 LiteralStringStripped = LHSStripped;
11332 }
else if ((isa<StringLiteral>(RHSStripped) ||
11333 isa<ObjCEncodeExpr>(RHSStripped)) &&
11336 LiteralString = RHS;
11337 LiteralStringStripped = RHSStripped;
11340 if (LiteralString) {
11342 S.
PDiag(diag::warn_stringcompare)
11343 << isa<ObjCEncodeExpr>(LiteralStringStripped)
11355 llvm_unreachable(
"unhandled cast kind");
11357 case CK_UserDefinedConversion:
11359 case CK_LValueToRValue:
11361 case CK_ArrayToPointerDecay:
11363 case CK_FunctionToPointerDecay:
11365 case CK_IntegralCast:
11367 case CK_FloatingCast:
11369 case CK_IntegralToFloating:
11370 case CK_FloatingToIntegral:
11372 case CK_IntegralComplexCast:
11373 case CK_FloatingComplexCast:
11374 case CK_FloatingComplexToIntegralComplex:
11375 case CK_IntegralComplexToFloatingComplex:
11377 case CK_FloatingComplexToReal:
11378 case CK_FloatingRealToComplex:
11379 case CK_IntegralComplexToReal:
11380 case CK_IntegralRealToComplex:
11393 if (
const auto *ICE = dyn_cast<ImplicitCastExpr>(E))
11420 << 0 << FromType << ToType;
11425 llvm_unreachable(
"unhandled case in switch");
11452 if (NumEnumArgs == 1) {
11454 QualType OtherTy = LHSIsEnum ? RHSStrippedType : LHSStrippedType;
11460 if (NumEnumArgs == 2) {
11469 LHSStrippedType->
castAs<
EnumType>()->getDecl()->getIntegerType();
11470 assert(IntType->isArithmeticType());
11475 if (IntType->isPromotableIntegerType())
11480 LHSType = RHSType = IntType;
11504 assert(!
Type.isNull() &&
"composite type for <=> has not been set");
11545 if (
const auto *CL = dyn_cast<CharacterLiteral>(E.
get())) {
11546 if (CL->getValue() == 0)
11550 NullValue ?
"NULL" :
"(void *)0");
11551 }
else if (
const auto *CE = dyn_cast<CStyleCastExpr>(E.
get())) {
11558 NullValue ?
"NULL" :
"(void *)0");
11568 bool IsThreeWay = Opc == BO_Cmp;
11569 bool IsOrdered = IsRelational || IsThreeWay;
11580 if (!IsThreeWay || IsAnyPointerType(LHS) || IsAnyPointerType(RHS)) {
11623 auto computeResultTy = [&]() {
11637 if (CompositeTy->
isPointerType() && LHSIsNull != RHSIsNull) {
11641 Diag(Loc, diag::err_typecheck_three_way_comparison_of_pointer_and_zero)
11642 << (LHSIsNull ? LHS.
get()->getSourceRange()
11651 if (!IsOrdered && LHSIsNull != RHSIsNull) {
11652 bool IsEquality = Opc == BO_EQ;
11683 return computeResultTy();
11699 (IsOrdered ? 2 : 1) &&
11704 return computeResultTy();
11718 if (IsRelational) {
11723 Diag(Loc, diag::ext_typecheck_compare_complete_incomplete_pointers)
11730 Diag(Loc, diag::ext_typecheck_ordered_comparison_of_function_pointers)
11735 }
else if (!IsRelational &&
11739 && !LHSIsNull && !RHSIsNull)
11746 if (LCanPointeeTy != RCanPointeeTy) {
11751 diag::err_typecheck_op_on_nonoverlapping_address_space_pointers)
11752 << LHSType << RHSType << 0
11758 CastKind Kind = AddrSpaceL != AddrSpaceR ? CK_AddressSpaceConversion
11760 if (LHSIsNull && !RHSIsNull)
11765 return computeResultTy();
11772 if (!IsOrdered && LHSIsNull && RHSIsNull) {
11775 return computeResultTy();
11779 return computeResultTy();
11788 return computeResultTy();
11793 return computeResultTy();
11796 if (IsRelational &&
11805 if (isa<FunctionDecl>(DC))
11807 if (
auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(DC)) {
11808 if (CTSD->isInStdNamespace() &&
11809 llvm::StringSwitch<bool>(CTSD->getName())
11810 .Cases(
"less",
"less_equal",
"greater",
"greater_equal",
true)
11816 return computeResultTy();
11829 return computeResultTy();
11839 if (!LHSIsNull && !RHSIsNull &&
11841 Diag(Loc, diag::err_typecheck_comparison_of_distinct_blocks)
11846 return computeResultTy();
11853 if (!LHSIsNull && !RHSIsNull) {
11858 Diag(Loc, diag::err_typecheck_comparison_of_distinct_blocks)
11862 if (LHSIsNull && !RHSIsNull)
11865 : CK_AnyPointerToBlockPointerCast);
11869 : CK_AnyPointerToBlockPointerCast);
11870 return computeResultTy();
11879 bool RPtrToVoid = RPT ? RPT->getPointeeType()->isVoidType() :
false;
11881 if (!LPtrToVoid && !RPtrToVoid &&
11889 if (LHSIsNull && !RHSIsNull) {
11895 RPT ? CK_BitCast :CK_CPointerToObjCPointerCast);
11904 LPT ? CK_BitCast :CK_CPointerToObjCPointerCast);
11906 return computeResultTy();
11916 if (LHSIsNull && !RHSIsNull)
11920 return computeResultTy();
11926 CK_BlockPointerToObjCPointerCast);
11927 return computeResultTy();
11928 }
else if (!IsOrdered &&
11932 CK_BlockPointerToObjCPointerCast);
11933 return computeResultTy();
11938 unsigned DiagID = 0;
11939 bool isError =
false;
11948 isError ? diag::err_typecheck_ordered_comparison_of_pointer_and_zero
11949 : diag::ext_typecheck_ordered_comparison_of_pointer_and_zero;
11952 DiagID = diag::err_typecheck_comparison_of_pointer_integer;
11954 }
else if (IsOrdered)
11955 DiagID = diag::ext_typecheck_ordered_comparison_of_pointer_integer;
11957 DiagID = diag::ext_typecheck_comparison_of_pointer_integer;
11969 LHSIsNull ? CK_NullToPointer : CK_IntegralToPointer);
11972 RHSIsNull ? CK_NullToPointer : CK_IntegralToPointer);
11973 return computeResultTy();
11977 if (!IsOrdered && RHSIsNull
11980 return computeResultTy();
11982 if (!IsOrdered && LHSIsNull
11985 return computeResultTy();
11990 return computeResultTy();
11994 return computeResultTy();
11997 if (LHSIsNull && RHSType->
isQueueT()) {
11999 return computeResultTy();
12002 if (LHSType->
isQueueT() && RHSIsNull) {
12004 return computeResultTy();
12020 if (isa<ExtVectorType>(VTy)) {
12030 "Unhandled vector element size in vector compare");
12047 "Unhandled vector element size in vector compare");
12059 if (Opc == BO_Cmp) {
12060 Diag(Loc, diag::err_three_way_vector_comparison);
12103 bool Negative =
false;
12104 bool ExplicitPlus =
false;
12105 const auto *LHSInt = dyn_cast<IntegerLiteral>(XorLHS.
get());
12106 const auto *RHSInt = dyn_cast<IntegerLiteral>(XorRHS.
get());
12112 if (
const auto *UO = dyn_cast<UnaryOperator>(XorRHS.
get())) {
12114 if (Opc != UO_Minus && Opc != UO_Plus)
12116 RHSInt = dyn_cast<IntegerLiteral>(UO->getSubExpr());
12119 Negative = (Opc == UO_Minus);
12120 ExplicitPlus = !Negative;
12126 const llvm::APInt &LeftSideValue = LHSInt->getValue();
12127 llvm::APInt RightSideValue = RHSInt->getValue();
12128 if (LeftSideValue != 2 && LeftSideValue != 10)
12131 if (LeftSideValue.getBitWidth() != RightSideValue.getBitWidth())
12136 llvm::StringRef ExprStr =
12141 llvm::StringRef XorStr =
12144 if (XorStr ==
"xor")
12155 RightSideValue = -RightSideValue;
12156 RHSStr =
"-" + RHSStr;
12157 }
else if (ExplicitPlus) {
12158 RHSStr =
"+" + RHSStr;
12161 StringRef LHSStrRef = LHSStr;
12162 StringRef RHSStrRef = RHSStr;
12165 if (LHSStrRef.startswith(
"0b") || LHSStrRef.startswith(
"0B") ||
12166 RHSStrRef.startswith(
"0b") || RHSStrRef.startswith(
"0B") ||
12167 LHSStrRef.startswith(
"0x") || LHSStrRef.startswith(
"0X") ||
12168 RHSStrRef.startswith(
"0x") || RHSStrRef.startswith(
"0X") ||
12169 (LHSStrRef.size() > 1 && LHSStrRef.startswith(
"0")) ||
12170 (RHSStrRef.size() > 1 && RHSStrRef.startswith(
"0")) ||
12171 LHSStrRef.find(
'\'') != StringRef::npos ||
12172 RHSStrRef.find(
'\'') != StringRef::npos)
12176 const llvm::APInt XorValue = LeftSideValue ^ RightSideValue;
12177 int64_t RightSideIntValue = RightSideValue.getSExtValue();
12178 if (LeftSideValue == 2 && RightSideIntValue >= 0) {
12179 std::string SuggestedExpr =
"1 << " + RHSStr;
12180 bool Overflow =
false;
12181 llvm::APInt One = (LeftSideValue - 1);
12182 llvm::APInt PowValue = One.sshl_ov(RightSideValue, Overflow);
12184 if (RightSideIntValue < 64)
12185 S.
Diag(Loc, diag::warn_xor_used_as_pow_base)
12186 << ExprStr << XorValue.toString(10,
true) << (
"1LL << " + RHSStr)
12188 else if (RightSideIntValue == 64)
12189 S.
Diag(Loc, diag::warn_xor_used_as_pow) << ExprStr << XorValue.toString(10,
true);
12193 S.
Diag(Loc, diag::warn_xor_used_as_pow_base_extra)
12194 << ExprStr << XorValue.toString(10,
true) << SuggestedExpr
12195 << PowValue.toString(10,
true)
12197 ExprRange, (RightSideIntValue == 0) ?
"1" : SuggestedExpr);
12200 S.
Diag(Loc, diag::note_xor_used_as_pow_silence) << (
"0x2 ^ " + RHSStr) << SuggestXor;
12201 }
else if (LeftSideValue == 10) {
12202 std::string SuggestedValue =
"1e" + std::to_string(RightSideIntValue);
12203 S.
Diag(Loc, diag::warn_xor_used_as_pow_base)
12204 << ExprStr << XorValue.toString(10,
true) << SuggestedValue
12206 S.
Diag(Loc, diag::note_xor_used_as_pow_silence) << (
"0xA ^ " + RHSStr) << SuggestXor;
12234 bool IsCompAssign) {
12235 if (!IsCompAssign) {
12251 assert((LHSMatType || RHSMatType) &&
"At least one operand must be a matrix");
12260 if (LHSMatType && !RHSMatType) {
12268 if (!LHSMatType && RHSMatType) {
12280 bool IsCompAssign) {
12281 if (!IsCompAssign) {
12292 assert((LHSMatType || RHSMatType) &&
"At least one operand must be a matrix");
12294 if (LHSMatType && RHSMatType) {
12295 if (LHSMatType->getNumColumns() != RHSMatType->
getNumRows())
12303 LHSMatType->getNumRows(),
12314 bool IsCompAssign =
12315 Opc == BO_AndAssign || Opc == BO_OrAssign || Opc == BO_XorAssign;
12334 ExprResult LHSResult = LHS, RHSResult = RHS;
12337 if (LHSResult.
isInvalid() || RHSResult.isInvalid())
12339 LHS = LHSResult.
get();
12340 RHS = RHSResult.
get();
12358 bool EnumConstantInBoolContext =
false;
12360 if (
const auto *DREHS = dyn_cast<DeclRefExpr>(HS.get())) {
12361 const auto *ECDHS = dyn_cast<EnumConstantDecl>(DREHS->getDecl());
12362 if (ECDHS && ECDHS->getInitVal() != 0 && ECDHS->getInitVal() != 1)
12363 EnumConstantInBoolContext =
true;
12367 if (EnumConstantInBoolContext)
12368 Diag(Loc, diag::warn_enum_constant_in_bool_context);
12388 Diag(Loc, diag::warn_logical_instead_of_bitwise)
12390 << (Opc == BO_LAnd ?
"&&" :
"||");
12392 Diag(Loc, diag::note_logical_instead_of_bitwise_change_operator)
12393 << (Opc == BO_LAnd ?
"&" :
"|")
12396 Opc == BO_LAnd ?
"&" :
"|");
12397 if (Opc == BO_LAnd)
12399 Diag(Loc, diag::note_logical_instead_of_bitwise_remove_constant)
12455 const MemberExpr *ME = dyn_cast<MemberExpr>(E);
12456 if (!ME)
return false;
12460 if (!
Base)
return false;
12461 return Base->getMethodDecl() !=
nullptr;
12481 assert(var->
hasLocalStorage() &&
"capture added 'const' to non-local?");
12489 if (
auto *FD = dyn_cast<FunctionDecl>(DC))
12532 bool DiagnosticEmitted =
false;
12536 bool IsDereference =
false;
12537 bool NextIsDereference =
false;
12541 IsDereference = NextIsDereference;
12544 if (
const MemberExpr *ME = dyn_cast<MemberExpr>(E)) {
12545 NextIsDereference = ME->isArrow();
12546 const ValueDecl *VD = ME->getMemberDecl();
12547 if (
const FieldDecl *Field = dyn_cast<FieldDecl>(VD)) {
12549 if (Field->isMutable()) {
12550 assert(DiagnosticEmitted &&
"Expected diagnostic not emitted.");
12555 if (!DiagnosticEmitted) {
12556 S.
Diag(Loc, diag::err_typecheck_assign_const)
12558 << Field->getType();
12559 DiagnosticEmitted =
true;
12562 <<
ConstMember <<
false << Field << Field->getType()
12563 << Field->getSourceRange();
12567 }
else if (
const VarDecl *VDecl = dyn_cast<VarDecl>(VD)) {
12568 if (VDecl->getType().isConstQualified()) {
12569 if (!DiagnosticEmitted) {
12570 S.
Diag(Loc, diag::err_typecheck_assign_const)
12572 << VDecl->getType();
12573 DiagnosticEmitted =
true;
12576 <<
ConstMember <<
true << VDecl << VDecl->getType()
12577 << VDecl->getSourceRange();
12584 dyn_cast<ArraySubscriptExpr>(E)) {
12588 dyn_cast<ExtVectorElementExpr>(E)) {
12595 if (
const CallExpr *CE = dyn_cast<CallExpr>(E)) {
12599 if (!DiagnosticEmitted) {
12600 S.
Diag(Loc, diag::err_typecheck_assign_const) << ExprRange
12602 DiagnosticEmitted =
true;
12605 diag::note_typecheck_assign_const)
12609 }
else if (
const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E)) {
12611 if (
const ValueDecl *VD = DRE->getDecl()) {
12613 if (!DiagnosticEmitted) {
12614 S.
Diag(Loc, diag::err_typecheck_assign_const)
12616 DiagnosticEmitted =
true;
12618 S.
Diag(VD->getLocation(), diag::note_typecheck_assign_const)
12619 <<
ConstVariable << VD << VD->getType() << VD->getSourceRange();
12622 }
else if (isa<CXXThisExpr>(E)) {
12624 if (
const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(DC)) {
12625 if (MD->isConst()) {
12626 if (!DiagnosticEmitted) {
12627 S.
Diag(Loc, diag::err_typecheck_assign_const) << ExprRange
12629 DiagnosticEmitted =
true;
12631 S.
Diag(MD->getLocation(), diag::note_typecheck_assign_const)
12638 if (DiagnosticEmitted)
12642 S.
Diag(Loc, diag::err_typecheck_assign_const) << ExprRange <<
ConstUnknown;
12655 bool &DiagnosticEmitted) {
12656 std::vector<const RecordType *> RecordTypeList;
12657 RecordTypeList.push_back(Ty);
12658 unsigned NextToCheckIndex = 0;
12661 while (RecordTypeList.size() > NextToCheckIndex) {
12662 bool IsNested = NextToCheckIndex > 0;
12664 RecordTypeList[NextToCheckIndex]->getDecl()->fields()) {
12666 QualType FieldTy = Field->getType();
12668 if (!DiagnosticEmitted) {
12669 S.
Diag(Loc, diag::err_typecheck_assign_const)
12671 << IsNested << Field;
12672 DiagnosticEmitted =
true;
12674 S.
Diag(Field->getLocation(), diag::note_typecheck_assign_const)
12676 << FieldTy << Field->getSourceRange();
12682 if (llvm::find(RecordTypeList, FieldRecTy) == RecordTypeList.end())
12683 RecordTypeList.push_back(FieldRecTy);
12686 ++NextToCheckIndex;
12695 assert(Ty->
isRecordType() &&
"lvalue was not record?");
12698 bool DiagEmitted =
false;
12700 if (
const MemberExpr *ME = dyn_cast<MemberExpr>(E))
12703 else if (
const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E))
12728 unsigned DiagID = 0;
12729 bool NeedType =
false;
12736 DiagID = diag::err_block_decl_ref_not_modifiable_lvalue;
12738 DiagID = diag::err_lambda_decl_ref_not_modifiable_lvalue;
12746 if (declRef && isa<VarDecl>(declRef->
getDecl())) {
12759 ? diag::err_typecheck_arc_assign_self_class_method
12760 : diag::err_typecheck_arc_assign_self;
12764 isa<ParmVarDecl>(var)) {
12765 DiagID = diag::err_typecheck_arc_assign_externally_retained;
12769 DiagID = diag::err_typecheck_arr_assign_enumeration;
12773 if (Loc != OrigLoc)
12799 DiagID = diag::err_typecheck_array_not_modifiable_lvalue;
12803 DiagID = diag::err_typecheck_non_object_not_modifiable_lvalue;
12807 DiagID = diag::err_typecheck_lvalue_casts_not_supported;
12810 llvm_unreachable(
"did not take early return for MLV_Valid");
12814 DiagID = diag::err_typecheck_expression_not_modifiable_lvalue;
12819 diag::err_typecheck_incomplete_type_not_modifiable_lvalue, E);
12821 DiagID = diag::err_typecheck_duplicate_vector_components_not_mlvalue;
12824 llvm_unreachable(
"readonly properties should be processed differently");
12826 DiagID = diag::err_readonly_message_assignment;
12829 DiagID = diag::err_no_subobject_property_setting;
12834 if (Loc != OrigLoc)
12856 MemberExpr *ML = dyn_cast<MemberExpr>(LHSExpr);
12857 MemberExpr *MR = dyn_cast<MemberExpr>(RHSExpr);
12859 if (!(isa<CXXThisExpr>(ML->
getBase()) && isa<CXXThisExpr>(MR->
getBase())))
12865 if (LHSDecl != RHSDecl)
12870 if (RefTy->getPointeeType().isVolatileQualified())
12873 Sema.
Diag(Loc, diag::warn_identity_field_assign) << 0;
12883 Sema.
Diag(Loc, diag::warn_identity_field_assign) << 1;
12905 Diag(Loc, diag::err_opencl_half_load_store) << 1
12911 if (CompoundType.
isNull()) {
12930 Diag(Loc, diag::err_objc_object_assignment)
12937 RHSCheck = ICE->getSubExpr();
12938 if (
UnaryOperator *UO = dyn_cast<UnaryOperator>(RHSCheck)) {
12939 if ((UO->getOpcode() == UO_Plus || UO->getOpcode() == UO_Minus) &&
12940 Loc.
isFileID() && UO->getOperatorLoc().isFileID() &&
12946 UO->getSubExpr()->getBeginLoc().
isFileID()) {
12947 Diag(Loc, diag::warn_not_compound_assign)
12948 << (UO->getOpcode() == UO_Plus ?
"+" :
"-")
12949 <<
SourceRange(UO->getOperatorLoc(), UO->getOperatorLoc());
12959 const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(InnerLHS);
12995 if (CompoundType.
isNull()) {
13005 Diag(Loc, diag::warn_deprecated_compound_assign_volatile) << LHSType;
13024 if (
const CastExpr *CE = dyn_cast<CastExpr>(E)) {
13025 if (CE->getCastKind() == CK_ToVoid) {
13031 CE->getSubExpr()->getType()->isDependentType()) {
13058 const unsigned ForIncrementFlags =
13064 if ((ScopeFlags & ForIncrementFlags) == ForIncrementFlags ||
13065 (ScopeFlags & ForInitFlags) == ForInitFlags)
13070 while (
const BinaryOperator *BO = dyn_cast<BinaryOperator>(LHS)) {
13071 if (BO->getOpcode() != BO_Comma)
13073 LHS = BO->getRHS();
13080 Diag(Loc, diag::warn_comma_operator);
13084 LangOpts.CPlusPlus ?
"static_cast<void>("
13116 diag::err_incomplete_type);
13131 bool IsInc,
bool IsPrefix) {
13140 ResType = ResAtomicType->getValueType();
13142 assert(!ResType.
isNull() &&
"no type for increment/decrement expression");
13152 : diag::warn_increment_bool)
13156 S.
Diag(OpLoc, diag::err_increment_decrement_enum) << IsInc << ResType;
13172 S.
Diag(OpLoc, diag::ext_integer_increment_complex)
13189 S.
Diag(OpLoc, diag::err_typecheck_illegal_increment_decrement)
13200 S.
Diag(OpLoc, diag::warn_deprecated_increment_decrement_volatile)
13201 << IsInc << ResType;
13234 case Stmt::DeclRefExprClass:
13236 case Stmt::MemberExprClass:
13240 if (cast<MemberExpr>(E)->isArrow())
13244 case Stmt::ArraySubscriptExprClass: {
13249 if (ICE->getSubExpr()->getType()->isArrayType())
13254 case Stmt::UnaryOperatorClass: {
13266 case Stmt::ParenExprClass:
13268 case Stmt::ImplicitCastExprClass:
13272 case Stmt::CXXUuidofExprClass:
13282 AO_Vector_Element = 1,
13283 AO_Property_Expansion = 2,
13284 AO_Register_Variable = 3,
13285 AO_Matrix_Element = 4,
13306 if (PTy->getKind() == BuiltinType::Overload) {
13308 if (!isa<OverloadExpr>(E)) {
13309 assert(cast<UnaryOperator>(E)->getOpcode() == UO_AddrOf);
13310 Diag(OpLoc, diag::err_typecheck_invalid_lvalue_addrof_addrof_function)
13316 if (isa<UnresolvedMemberExpr>(Ovl))
13318 Diag(OpLoc, diag::err_invalid_form_pointer_member_function)
13326 if (PTy->getKind() == BuiltinType::UnknownAny)
13329 if (PTy->getKind() == BuiltinType::BoundMember) {
13330 Diag(OpLoc, diag::err_invalid_form_pointer_member_function)
13353 auto* VarRef = dyn_cast<DeclRefExpr>(op);
13354 if (VarRef && VarRef->refersToEnclosingVariableOrCapture()) {
13355 Diag(op->
getExprLoc(), diag::err_opencl_taking_address_capture);
13363 if (uOp->getOpcode() == UO_Deref)
13366 return uOp->getSubExpr()->getType();
13373 if (
auto *FD = dyn_cast_or_null<FunctionDecl>(dcl))
13379 unsigned AddressOfError = AO_No_Error;
13384 : diag::ext_typecheck_addrof_temporary)
13391 }
else if (isa<ObjCSelectorExpr>(op)) {
13398 if (!isa<DeclRefExpr>(op)) {
13399 Diag(OpLoc, diag::err_invalid_form_pointer_member_function)
13407 if (OrigOp.
get() != DRE) {
13408 Diag(OpLoc, diag::err_parens_pointer_member_function)
13414 Diag(OpLoc, diag::err_unqualified_pointer_member_function)
13419 Diag(OpLoc, diag::err_unqualified_pointer_member_function)
13426 if (isa<CXXDestructorDecl>(MD))
13440 if (isa<PseudoObjectExpr>(op)) {
13441 AddressOfError = AO_Property_Expansion;
13443 Diag(OpLoc, diag::err_typecheck_invalid_lvalue_addrof)
13450 AddressOfError = AO_Bit_Field;
13453 AddressOfError = AO_Vector_Element;
13456 AddressOfError = AO_Matrix_Element;
13460 if (
const VarDecl *vd = dyn_cast<VarDecl>(dcl)) {
13465 AddressOfError = AO_Register_Variable;
13467 }
else if (isa<MSPropertyDecl>(dcl)) {
13468 AddressOfError = AO_Property_Expansion;
13469 }
else if (isa<FunctionTemplateDecl>(dcl)) {
13471 }
else if (isa<FieldDecl>(dcl) || isa<IndirectFieldDecl>(dcl)) {
13475 if (isa<DeclRefExpr>(op) && cast<DeclRefExpr>(op)->getQualifier()) {
13480 diag::err_cannot_form_pointer_to_member_of_reference_type)
13485 while (cast<RecordDecl>(Ctx)->isAnonymousStructOrUnion())
13497 }
else if (!isa<FunctionDecl>(dcl) && !isa<NonTypeTemplateParmDecl>(dcl) &&
13498 !isa<BindingDecl>(dcl) && !isa<MSGuidDecl>(dcl))
13499 llvm_unreachable(
"Unknown/unexpected decl type");
13502 if (AddressOfError != AO_No_Error) {
13518 CheckAddressOfPackedMember(op);
13524 const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(Exp);
13530 const ParmVarDecl *Param = dyn_cast<ParmVarDecl>(D);
13533 if (
const FunctionDecl* FD = dyn_cast<FunctionDecl>(Param->getDeclContext()))
13537 if (!FD->ModifiedNonNullParams.count(Param))
13538 FD->ModifiedNonNullParams.insert(Param);
13550 Op = ConvResult.
get();
13554 if (isa<CXXReinterpretCastExpr>(Op)) {
13562 Result = PT->getPointeeType();
13570 if (PR.
get() != Op)
13575 S.
Diag(OpLoc, diag::err_typecheck_indirection_requires_pointer)
13590 S.
Diag(OpLoc, diag::ext_typecheck_indirection_through_void_pointer)
13606 default: llvm_unreachable(
"Unknown binop!");
13607 case tok::periodstar: Opc = BO_PtrMemD;
break;
13608 case tok::arrowstar: Opc = BO_PtrMemI;
break;
13609 case tok::star: Opc = BO_Mul;
break;
13610 case tok::slash: Opc = BO_Div;
break;
13611 case tok::percent: Opc = BO_Rem;
break;
13612 case tok::plus: Opc = BO_Add;
break;
13613 case tok::minus: Opc = BO_Sub;
break;
13614 case tok::lessless: Opc = BO_Shl;
break;
13615 case tok::greatergreater: Opc = BO_Shr;
break;
13616 case tok::lessequal: Opc = BO_LE;
break;
13617 case tok::less: Opc = BO_LT;
break;
13618 case tok::greaterequal: Opc = BO_GE;
break;
13619 case tok::greater: Opc = BO_GT;
break;
13620 case tok::exclaimequal: Opc = BO_NE;
break;
13621 case tok::equalequal: Opc = BO_EQ;
break;
13622 case tok::spaceship: Opc = BO_Cmp;
break;
13623 case tok::amp: Opc = BO_And;
break;
13624 case tok::caret: Opc = BO_Xor;
break;
13625 case tok::pipe: Opc = BO_Or;
break;
13626 case tok::ampamp: Opc = BO_LAnd;
break;
13627 case tok::pipepipe: Opc = BO_LOr;
break;
13628 case tok::equal: Opc = BO_Assign;
break;
13629 case tok::starequal: Opc = BO_MulAssign;
break;
13630 case tok::slashequal: Opc = BO_DivAssign;
break;
13631 case tok::percentequal: Opc = BO_RemAssign;
break;
13632 case tok::plusequal: Opc = BO_AddAssign;
break;
13633 case tok::minusequal: Opc = BO_SubAssign;
break;
13634 case tok::lesslessequal: Opc = BO_ShlAssign;
break;
13635 case tok::greatergreaterequal: Opc = BO_ShrAssign;
break;
13636 case tok::ampequal: Opc = BO_AndAssign;
break;
13637 case tok::caretequal: Opc = BO_XorAssign;
break;
13638 case tok::pipeequal: Opc = BO_OrAssign;
break;
13639 case tok::comma: Opc = BO_Comma;
break;
13648 default: llvm_unreachable(
"Unknown unary op!");
13649 case tok::plusplus: Opc = UO_PreInc;
break;
13650 case tok::minusminus: Opc = UO_PreDec;
break;
13651 case tok::amp: Opc = UO_AddrOf;
break;
13652 case tok::star: Opc = UO_Deref;
break;
13653 case tok::plus: Opc = UO_Plus;
break;
13654 case tok::minus: Opc = UO_Minus;
break;
13655 case tok::tilde: Opc = UO_Not;
break;
13656 case tok::exclaim: Opc = UO_LNot;
break;
13657 case tok::kw___real: Opc = UO_Real;
break;
13658 case tok::kw___imag: Opc = UO_Imag;
break;
13659 case tok::kw___extension__: Opc = UO_Extension;
break;
13676 const DeclRefExpr *LHSDeclRef = dyn_cast<DeclRefExpr>(LHSExpr);
13677 const DeclRefExpr *RHSDeclRef = dyn_cast<DeclRefExpr>(RHSExpr);
13678 if (!LHSDeclRef || !RHSDeclRef ||
13686 if (LHSDecl != RHSDecl)
13691 if (RefTy->getPointeeType().isVolatileQualified())
13694 S.
Diag(OpLoc, IsBuiltin ? diag::warn_self_assignment_builtin
13695 : diag::warn_self_assignment_overloaded)
13707 const Expr *ObjCPointerExpr =
nullptr, *OtherExpr =
nullptr;
13712 ObjCPointerExpr = LHS;
13716 ObjCPointerExpr = RHS;
13724 if (ObjCPointerExpr && isa<IntegerLiteral>(OtherExpr->IgnoreParenCasts())) {
13725 unsigned Diag = diag::warn_objc_pointer_masking;
13733 StringRef SelArg0 = S.getNameForSlot(0);
13734 if (SelArg0.startswith(
"performSelector"))
13735 Diag = diag::warn_objc_pointer_masking_performSelector;
13746 if (
auto *DRE = dyn_cast<DeclRefExpr>(E))
13747 return DRE->getDecl();
13748 if (
auto *ME = dyn_cast<MemberExpr>(E))
13749 return ME->getMemberDecl();
13750 if (
auto *IRE = dyn_cast<ObjCIvarRefExpr>(E))
13751 return IRE->getDecl();
13766 "Result must be a vector of half or short");
13769 "both operands expected to be a half vector");
13781 ResultTy, VK, OK, OpLoc, FPFeatures,
13782 BinOpResTy, BinOpResTy);
13786 BinOpResTy, VK, OK, OpLoc, FPFeatures);
13790static std::pair<ExprResult, ExprResult>
13800 RHS,
nullptr,
false,
13801 [Opc, LHS](
Expr *E) {
13802 if (Opc != BO_Assign)
13809 return std::make_pair(LHS, RHS);
13816 if (!OpRequiresConversion || Ctx.
getLangOpts().NativeHalfType ||
13820 auto HasVectorOfHalfType = [&Ctx](
Expr *E) {
13830 return VT->getElementType().getCanonicalType() == Ctx.
HalfTy;
13835 return HasVectorOfHalfType(E0) && (!E1 || HasVectorOfHalfType(E1));
13857 if (Init.isInvalid())
13859 RHSExpr = Init.get();
13869 bool ConvertHalfVec =
false;
13872 if (!LHS.
isUsable() || !RHS.isUsable())
13882 if (BO_Assign == Opc)
13883 Diag(OpLoc, diag::err_opencl_atomic_init) << 0 << SR;
13908 if (!ResultTy.
isNull()) {
13925 if (
auto *BE = dyn_cast<BlockExpr>(RHS.get()->IgnoreParens()))
13927 if (
auto *VD = dyn_cast<VarDecl>(DRE->getDecl()))
13928 if (VD->hasLocalStorage() &&
getCurScope()->isDeclScope(VD))
13929 BE->getBlockDecl()->setCanAvoidCopyToHeap();
13940 Opc == BO_PtrMemI);
13944 ConvertHalfVec =
true;
13952 ConvertHalfVec =
true;
13956 ConvertHalfVec =
true;
13967 ConvertHalfVec =
true;
13972 ConvertHalfVec =
true;
13976 ConvertHalfVec =
true;
13989 ConvertHalfVec =
true;
13994 ConvertHalfVec =
true;
13996 Opc == BO_DivAssign);
13997 CompLHSTy = CompResultTy;
14003 CompLHSTy = CompResultTy;
14008 ConvertHalfVec =
true;
14014 ConvertHalfVec =
true;
14022 CompLHSTy = CompResultTy;
14032 CompLHSTy = CompResultTy;
14039 VK = RHS.get()->getValueKind();
14040 OK = RHS.get()->getObjectKind();
14054 "both sides are half vectors or neither sides are");
14059 CheckArrayAccess(LHS.
get());
14060 CheckArrayAccess(RHS.get());
14066 if (ObjectSetClass && isa<ObjCIsaExpr>(LHS.
get())) {
14070 "object_setClass(")
14083 if (CompResultTy.
isNull()) {
14084 if (ConvertHalfVec)
14104 if (ConvertHalfVec)
14109 Context, LHS.
get(), RHS.get(), Opc, ResultTy, VK, OK, OpLoc,
14126 if (isLeftComp == isRightComp)
14131 bool isLeftBitwise = LHSBO && LHSBO->
isBitwiseOp();
14132 bool isRightBitwise = RHSBO && RHSBO->
isBitwiseOp();
14133 if (isLeftBitwise || isRightBitwise)
14145 Self.
Diag(OpLoc, diag::warn_precedence_bitwise_rel)
14148 Self.
PDiag(diag::note_precedence_silence) << OpStr,
14149 (isLeftComp ? LHSExpr : RHSExpr)->getSourceRange());
14151 Self.
PDiag(diag::note_precedence_bitwise_first)
14166 Self.
PDiag(diag::note_precedence_silence)
14191 if (Bop->getOpcode() == BO_LAnd) {
14198 }
else if (Bop->getOpcode() == BO_LOr) {
14199 if (
BinaryOperator *RBop = dyn_cast<BinaryOperator>(Bop->getRHS())) {
14202 if (RBop->getOpcode() == BO_LAnd &&
EvaluatesAsTrue(S, RBop->getRHS()))
14213 if (Bop->getOpcode() == BO_LAnd) {
14230 if (Bop->isBitwiseOp() && Bop->getOpcode() < Opc) {
14231 S.
Diag(Bop->getOperatorLoc(), diag::warn_bitwise_op_in_bitwise_op)
14233 << Bop->getSourceRange() << OpLoc;
14235 S.
PDiag(diag::note_precedence_silence)
14236 << Bop->getOpcodeStr(),
14237 Bop->getSourceRange());
14243 Expr *SubExpr, StringRef Shift) {
14245 if (Bop->getOpcode() == BO_Add || Bop->getOpcode() == BO_Sub) {
14246 StringRef Op = Bop->getOpcodeStr();
14247 S.
Diag(Bop->getOperatorLoc(), diag::warn_addition_in_bitshift)
14248 << Bop->getSourceRange() << OpLoc << Shift << Op;
14250 S.
PDiag(diag::note_precedence_silence) << Op,
14251 Bop->getSourceRange());
14267 if (Kind != OO_LessLess && Kind != OO_GreaterGreater)
14270 S.
Diag(OpLoc, diag::warn_overloaded_shift_in_comparison)
14272 << (Kind == OO_LessLess);
14274 S.
PDiag(diag::note_precedence_silence)
14275 << (Kind == OO_LessLess ?
"<<" :
">>"),
14278 S, OpLoc, S.
PDiag(diag::note_evaluate_comparison_first),
14292 if ((Opc == BO_Or || Opc == BO_Xor) &&
14300 if (Opc == BO_LOr && !OpLoc.
isMacroID()) {
14306 || Opc == BO_Shr) {
14323 assert(LHSExpr &&
"ActOnBinOp(): missing left expression");
14324 assert(RHSExpr &&
"ActOnBinOp(): missing right expression");
14329 return BuildBinOp(S, TokLoc, Opc, LHSExpr, RHSExpr);
14335 if (OverOp !=
OO_None && OverOp != OO_Equal)
14380 LHSExpr = LHS.
get();
14381 RHSExpr = RHS.
get();
14392 if (pty->getKind() == BuiltinType::PseudoObject &&
14405 RHSExpr = resolvedRHS.
get();
14419 (pty->getKind() == BuiltinType::BoundMember ||
14420 pty->getKind() == BuiltinType::Overload)) {
14421 auto *OE = dyn_cast<OverloadExpr>(LHSExpr);
14422 if (OE && !OE->hasTemplateKeyword() && !OE->hasExplicitTemplateArgs() &&
14423 std::any_of(OE->decls_begin(), OE->decls_end(), [](
NamedDecl *ND) {
14424 return isa<FunctionTemplateDecl>(ND);
14426 Diag(OE->getQualifier() ? OE->getQualifierLoc().getBeginLoc()
14427 : OE->getNameLoc(),
14428 diag::err_template_kw_missing)
14429 << OE->getName().getAsString() <<
"";
14436 LHSExpr = LHS.
get();
14443 if (Opc == BO_Assign && pty->getKind() == BuiltinType::Overload) {
14459 RHSExpr = resolvedRHS.
get();
14479 "Should only occur in error-recovery path.");
14485 Context, LHSExpr, RHSExpr, Opc,
14505 ResultType = RHSExpr->
getType();
14521 if (T.isNull() || T->isDependentType())
14524 if (!T->isPromotableIntegerType())
14537 bool CanOverflow =
false;
14539 bool ConvertHalfVec =
false;
14548 return ExprError(
Diag(OpLoc, diag::err_typecheck_unary_expr)
14561 Opc == UO_PreInc ||
14563 Opc == UO_PreInc ||
14569 CheckAddressOfNoDeref(InputExpr);
14580 CanOverflow = Opc == UO_Minus &&
14591 if (ConvertHalfVec)
14609 return ExprError(
Diag(OpLoc, diag::err_typecheck_unary_expr)
14622 Diag(OpLoc, diag::ext_integer_complement_complex)
14630 if (!T->isIntegerType())
14631 return ExprError(
Diag(OpLoc, diag::err_typecheck_unary_expr)
14634 return ExprError(
Diag(OpLoc, diag::err_typecheck_unary_expr)
14665 return ExprError(
Diag(OpLoc, diag::err_typecheck_unary_expr)
14675 if (!T->isIntegerType())
14676 return ExprError(
Diag(OpLoc, diag::err_typecheck_unary_expr)
14685 return ExprError(
Diag(OpLoc, diag::err_typecheck_unary_expr)
14692 return ExprError(
Diag(OpLoc, diag::err_typecheck_unary_expr)
14724 "the co_await expression must be non-dependant before "
14725 "building operator co_await");
14735 if (Opc != UO_AddrOf && Opc != UO_Deref)
14736 CheckArrayAccess(Input.
get());
14742 if (Opc == UO_Deref && UO->getType()->hasAttr(attr::NoDeref) &&
14743 !isa<ArrayType>(UO->getType().getDesugaredType(
Context)) &&
14748 if (ConvertHalfVec)
14757 if (
DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E)) {
14758 if (!DRE->getQualifier())
14765 if (isa<FieldDecl>(VD) || isa<IndirectFieldDecl>(VD))
14768 return Method->isInstance();
14774 if (!ULE->getQualifier())
14779 if (Method->isInstance())
14799 if (pty->getKind() == BuiltinType::PseudoObject &&
14804 if (Opc == UO_Extension)
14809 if (Opc == UO_AddrOf &&
14810 (pty->getKind() == BuiltinType::Overload ||
14811 pty->getKind() == BuiltinType::UnknownAny ||
14812 pty->getKind() == BuiltinType::BoundMember))
14870 assert(SubStmt && isa<CompoundStmt>(SubStmt) &&
"Invalid action invocation!");
14875 assert(!Cleanup.exprNeedsCleanups() &&
14876 "cleanups within StmtExpr not correctly bound!");
14886 bool StmtExprMayBindToTemp =
false;
14889 if (
const auto *LastStmt =
14892 StmtExprMayBindToTemp =
true;
14893 Ty =
Value->getType();
14900 Expr *ResStmtExpr =
14902 if (StmtExprMayBindToTemp)
14904 return ResStmtExpr;
14927 auto *Cast = dyn_cast<ImplicitCastExpr>(E);
14928 if (Cast && Cast->getCastKind() == CK_ARCConsumeObject)
14929 return Cast->getSubExpr();
14950 return ExprError(
Diag(BuiltinLoc, diag::err_offsetof_record_type)
14951 << ArgTy << TypeRange);
14957 diag::err_offsetof_incomplete_type, TypeRange))
14960 bool DidWarnAboutNonPOD =
false;
14965 if (OC.isBrackets) {
14970 return ExprError(
Diag(OC.LocEnd, diag::err_offsetof_array_type)
14990 Comps.push_back(
OffsetOfNode(OC.LocStart, Exprs.size(), OC.LocEnd));
14991 Exprs.push_back(Idx);
14999 Comps.push_back(
OffsetOfNode(OC.LocStart, OC.U.IdentInfo, OC.LocEnd));
15006 diag::err_offsetof_incomplete_type))
15012 return ExprError(
Diag(OC.LocEnd, diag::err_offsetof_record_type)
15024 bool IsSafe =
LangOpts.CPlusPlus11? CRD->isStandardLayout() : CRD->isPOD();
15026 LangOpts.CPlusPlus11? diag::ext_offsetof_non_standardlayout_type
15027 : diag::ext_offsetof_non_pod_type;
15029 if (!IsSafe && !DidWarnAboutNonPOD &&
15032 <<
SourceRange(Components[0].LocStart, OC.LocEnd)
15034 DidWarnAboutNonPOD =
true;
15044 MemberDecl = IndirectMemberDecl->getAnonField();
15049 << OC.U.IdentInfo << RD <<
SourceRange(OC.LocStart,
15057 Diag(OC.LocEnd, diag::err_offsetof_bitfield)
15065 if (IndirectMemberDecl)
15073 if (Paths.getDetectedVirtual()) {
15074 Diag(OC.LocEnd, diag::err_offsetof_field_of_virtual_base)
15085 if (IndirectMemberDecl) {
15086 for (
auto *FI : IndirectMemberDecl->chain()) {
15087 assert(isa<FieldDecl>(FI));
15089 cast<FieldDecl>(FI), OC.LocEnd));
15092 Comps.push_back(
OffsetOfNode(OC.LocStart, MemberDecl, OC.LocEnd));
15098 Comps, Exprs, RParenLoc);
15124 assert((CondExpr && LHSExpr && RHSExpr) &&
"Missing type argument(s)");
15129 bool CondIsTrue =
false;
15134 llvm::APSInt condEval(32);
15136 CondExpr, &condEval, diag::err_typecheck_choose_expr_requires_constant);
15139 CondExpr = CondICE.
get();
15140 CondIsTrue = condEval.getZExtValue();
15143 Expr *ActiveExpr = CondIsTrue ? LHSExpr : RHSExpr;
15145 resType = ActiveExpr->
getType();
15151 resType, VK, OK, RPLoc, CondIsTrue);
15164 Decl *ManglingContextDecl;
15165 std::tie(MCtx, ManglingContextDecl) =
15169 Block->setBlockMangling(ManglingNumber, ManglingContextDecl);
15191 "block-id should have no identifier!");
15212 assert(T->isFunctionType() &&
15213 "GetTypeForDeclarator made a non-function block signature");
15229 unsigned Size =
Result.getFullDataSize();
15241 QualType RetTy = Fn->getReturnType();
15259 if (ExplicitSignature) {
15260 for (
unsigned I = 0, E = ExplicitSignature.
getNumParams(); I != E; ++I) {
15262 if (Param->getIdentifier() ==
nullptr && !Param->isImplicit() &&
15266 Diag(Param->getLocation(), diag::ext_parameter_name_omitted_c2x);
15268 Params.push_back(Param);
15274 for (
const auto &I : Fn->param_types()) {
15277 Params.push_back(Param);
15282 if (!Params.empty()) {
15293 AI->setOwningFunction(CurBlock->
TheDecl);
15296 if (AI->getIdentifier()) {
15322 Diag(CaretLoc, diag::err_blocks_disable) <<
LangOpts.OpenCL;
15327 assert(!Cleanup.exprNeedsCleanups() &&
15328 "cleanups within block not correctly bound!");
15349 if (NoReturn && !Ext.getNoReturn()) Ext = Ext.
withNoReturn(
true);
15352 if (isa<FunctionNoProtoType>(FTy)) {
15387 BD->
setBody(cast<CompoundStmt>(Body));
15389 if (Body &&
getCurFunction()->HasPotentialAvailabilityViolations)
15413 Expr *CopyExpr =
nullptr;
15422 if (isa<ParmVarDecl>(Var))
15441 if (!
Result.isInvalid() &&
15442 !
Result.get()->getType().isConstQualified()) {
15444 Result.get()->getType().withConst(),
15448 if (!
Result.isInvalid()) {
15458 if (!
Result.isInvalid() &&
15459 !cast<CXXConstructExpr>(
Result.get())->getConstructor()
15462 CopyExpr =
Result.get();
15469 Captures.push_back(NewCap);
15481 if (
Result->getBlockDecl()->hasCaptures()) {
15484 Cleanup.setExprNeedsCleanups(
true);
15488 for (
const auto &CI :
Result->getBlockDecl()->captures()) {
15489 const VarDecl *var = CI.getVariable();
15513 Expr *OrigExpr = E;
15562 if (Init.isInvalid())
15564 E = Init.getAs<
Expr>();
15578 diag::err_first_argument_to_va_arg_not_of_type_va_list)
15583 diag::err_second_parameter_to_va_arg_incomplete,
15589 diag::err_second_parameter_to_va_arg_abstract,
15596 ? diag::warn_second_parameter_to_va_arg_ownership_qualified
15597 : diag::warn_second_parameter_to_va_arg_not_pod)
15612 if (!PromoteType.
isNull())
15614 PDiag(diag::warn_second_parameter_to_va_arg_never_compatible)
15636 llvm_unreachable(
"I don't know size of pointer!");
15671 if (OV->getSourceExpr())
15674 if (
auto *SL = dyn_cast<StringLiteral>(SrcExpr)) {
15676 !(ID && ID->getIdentifier()->isStr(
"NSString")))
15678 if (!SL->isAscii())
15682 Diag(SL->getBeginLoc(), diag::err_missing_atsign_prefix)
15689 if ((isa<IntegerLiteral>(SrcExpr) || isa<CharacterLiteral>(SrcExpr) ||
15690 isa<FloatingLiteral>(SrcExpr) || isa<ObjCBoolLiteralExpr>(SrcExpr) ||
15691 isa<CXXBoolLiteralExpr>(SrcExpr)) &&
15694 if (!ID || !ID->getIdentifier()->isStr(
"NSNumber"))
15712 const Expr *SrcExpr) {
15721 auto *FD = dyn_cast<FunctionDecl>(DRE->getDecl());
15734 bool *Complained) {
15736 *Complained =
false;
15739 bool CheckInferredResultType =
false;
15741 unsigned DiagKind = 0;
15743 bool MayHaveConvFixit =
false;
15744 bool MayHaveFunctionDiff =
false;
15755 DiagKind = diag::err_typecheck_convert_pointer_int;
15758 DiagKind = diag::ext_typecheck_convert_pointer_int;
15761 MayHaveConvFixit =
true;
15765 DiagKind = diag::err_typecheck_convert_int_pointer;
15768 DiagKind = diag::ext_typecheck_convert_int_pointer;
15771 MayHaveConvFixit =
true;
15775 DiagKind = diag::err_typecheck_convert_incompatible_function_pointer;
15778 DiagKind = diag::ext_typecheck_convert_incompatible_function_pointer;
15781 MayHaveConvFixit =
true;
15785 DiagKind = diag::err_arc_typecheck_convert_incompatible_pointer;
15787 DiagKind = diag::err_typecheck_convert_incompatible_pointer;
15790 DiagKind = diag::ext_typecheck_convert_incompatible_pointer;
15794 if (!CheckInferredResultType) {
15796 }
else if (CheckInferredResultType) {
15800 MayHaveConvFixit =
true;
15804 DiagKind = diag::err_typecheck_convert_incompatible_pointer_sign;
15807 DiagKind = diag::ext_typecheck_convert_incompatible_pointer_sign;
15812 DiagKind = diag::err_typecheck_convert_pointer_void_func;
15815 DiagKind = diag::ext_typecheck_convert_pointer_void_func;
15827 DiagKind = diag::err_typecheck_incompatible_address_space;
15831 DiagKind = diag::err_typecheck_incompatible_ownership;
15835 llvm_unreachable(
"unknown error case for discarding qualifiers!");
15852 DiagKind = diag::err_typecheck_convert_discards_qualifiers;
15855 DiagKind = diag::ext_typecheck_convert_discards_qualifiers;
15862 DiagKind = diag::err_nested_pointer_qualifier_mismatch;
15864 DiagKind = diag::ext_nested_pointer_qualifier_mismatch;
15868 DiagKind = diag::err_typecheck_incompatible_nested_address_space;
15872 DiagKind = diag::err_int_to_block_pointer;
15876 DiagKind = diag::err_typecheck_convert_incompatible_block_pointer;
15883 for (
auto *srcProto : srcOPT->
quals()) {
15889 IFace = IFaceT->getDecl();
15894 for (
auto *dstProto : dstOPT->
quals()) {
15900 IFace = IFaceT->getDecl();
15903 DiagKind = diag::err_incompatible_qualified_id;
15906 DiagKind = diag::warn_incompatible_qualified_id;
15912 DiagKind = diag::err_incompatible_vectors;
15915 DiagKind = diag::warn_incompatible_vectors;
15919 DiagKind = diag::err_arc_weak_unavailable_assign;
15925 *Complained =
true;
15929 DiagKind = diag::err_typecheck_convert_incompatible;
15931 MayHaveConvFixit =
true;
15933 MayHaveFunctionDiff =
true;
15942 FirstType = DstType;
15943 SecondType = SrcType;
15953 FirstType = SrcType;
15954 SecondType = DstType;
15962 FDiag << FirstType << SecondType << Action << SrcExpr->
getSourceRange();
15964 if (DiagKind == diag::ext_typecheck_convert_incompatible_pointer_sign ||
15965 DiagKind == diag::err_typecheck_convert_incompatible_pointer_sign) {
15975 if (!ConvHints.
isNull()) {
15980 if (MayHaveConvFixit) { FDiag << (
unsigned) (ConvHints.
Kind); }
15982 if (MayHaveFunctionDiff)
15986 if ((DiagKind == diag::warn_incompatible_qualified_id ||
15987 DiagKind == diag::err_incompatible_qualified_id) &&
15989 Diag(IFace->
getLocation(), diag::note_incomplete_class_and_qualified_id)
15996 if (CheckInferredResultType)
16003 *Complained =
true;
16014 return S.
Diag(Loc, diag::err_ice_not_integral)
16018 return S.
Diag(Loc, diag::err_expr_not_ice) << S.
LangOpts.CPlusPlus;
16033 IDDiagnoser(
unsigned DiagID)
16037 return S.
Diag(Loc, DiagID);
16039 } Diagnoser(DiagID);
16052 return S.
Diag(Loc, diag::ext_expr_not_ice) << S.
LangOpts.CPlusPlus;
16074 BaseDiagnoser(BaseDiagnoser) {}
16083 return S.
Diag(Loc, diag::err_ice_incomplete_type) << T;
16088 return S.
Diag(Loc, diag::err_ice_explicit_conversion) << T << ConvTy;
16099 return S.
Diag(Loc, diag::err_ice_ambiguous_conversion) << T;
16110 llvm_unreachable(
"conversion functions are permitted");
16112 } ConvertDiagnoser(Diagnoser);
16118 E = Converted.
get();
16133 E = RValueExpr.
get();
16140 if (!isa<ConstantExpr>(E))
16147 EvalResult.
Diag = &Notes;
16155 if (!isa<ConstantExpr>(E))
16170 if (Notes.size() == 1 && Notes[0].second.getDiagID() ==
16171 diag::note_invalid_subexpr_in_const_expr) {
16172 DiagLoc = Notes[0].first;
16176 if (!Folded || !CanFold) {
16198 class TransformToPE :
public TreeTransform<TransformToPE> {
16202 TransformToPE(
Sema &SemaRef) : BaseTransform(SemaRef) { }
16205 bool AlwaysRebuild() {
return true; }
16206 bool ReplacingOriginal() {
return true; }
16216 if (isa<FieldDecl>(E->
getDecl()) &&
16217 !SemaRef.isUnevaluatedContext())
16219 diag::err_invalid_non_static_member_use)
16222 return BaseTransform::TransformDeclRefExpr(E);
16230 return BaseTransform::TransformUnaryOperator(E);
16238 return SkipLambdaBody(E, Body);
16245 "Should only transform unevaluated expressions");
16250 return TransformToPE(*this).TransformExpr(E);
16258 LambdaContextDecl, ExprContext);
16276 if (
const auto *E = dyn_cast<UnaryOperator>(PossibleDeref)) {
16277 if (E->getOpcode() == UO_Deref)
16278 return CheckPossibleDeref(S, E->getSubExpr());
16279 }
else if (
const auto *E = dyn_cast<ArraySubscriptExpr>(PossibleDeref)) {
16280 return CheckPossibleDeref(S, E->getBase());
16281 }
else if (
const auto *E = dyn_cast<MemberExpr>(PossibleDeref)) {
16282 return CheckPossibleDeref(S, E->getBase());
16283 }
else if (
const auto E = dyn_cast<DeclRefExpr>(PossibleDeref)) {
16287 Inner = Ptr->getPointeeType();
16289 Inner = Arr->getElementType();
16293 if (Inner->hasAttr(attr::NoDeref))
16303 const DeclRefExpr *DeclRef = CheckPossibleDeref(*
this, E);
16310 Diag(E->
getExprLoc(), diag::warn_dereference_of_noderef_type_no_decl)
16329 if (BO->getOpcode() == BO_Assign) {
16331 LHSs.erase(std::remove(LHSs.begin(), LHSs.end(), BO->getLHS()),
16347 if (
auto *DeclRef =
16348 dyn_cast<DeclRefExpr>(Call->getCallee()->IgnoreImplicit()))
16358 ExprEvalContexts.back().ImmediateInvocationCandidates.emplace_back(Res, 0);
16366 Eval.
Diag = &Notes;
16369 Eval, SemaRef.
getASTContext(), ConstantExprKind::ImmediateInvocation);
16370 if (!
Result || !Notes.empty()) {
16372 if (
auto *
FunctionalCast = dyn_cast<CXXFunctionalCastExpr>(InnerExpr))
16375 if (
auto *Call = dyn_cast<CallExpr>(InnerExpr))
16377 else if (
auto *Call = dyn_cast<CXXConstructExpr>(InnerExpr))
16378 FD = Call->getConstructor();
16380 llvm_unreachable(
"unhandled decl kind");
16382 SemaRef.
Diag(CE->
getBeginLoc(), diag::err_invalid_consteval_call) << FD;
16383 for (
auto &
Note : Notes)
16395 llvm::SmallPtrSetImpl<DeclRefExpr *> &DRSet;
16399 ComplexRemove(
Sema &SemaRef, llvm::SmallPtrSetImpl<DeclRefExpr *> &DR,
16402 4>::reverse_iterator Current)
16403 :
Base(SemaRef), DRSet(DR), IISet(II), CurrentII(Current) {}
16405 auto It = std::find_if(CurrentII, IISet.rend(),
16407 return Elem.getPointer() == E;
16409 assert(It != IISet.rend() &&
16410 "ConstantExpr marked IsImmediateInvocation should "
16416 return Base::TransformConstantExpr(E);
16417 RemoveImmediateInvocation(E);
16418 return Base::TransformExpr(E->
getSubExpr());
16424 return Base::TransformCXXOperatorCallExpr(E);
16433 if (
auto *CE = dyn_cast<ConstantExpr>(Init))
16434 if (CE->isImmediateInvocation())
16435 RemoveImmediateInvocation(CE);
16436 return Base::TransformInitializer(Init, NotCopyInit);
16442 bool AlwaysRebuild() {
return false; }
16443 bool ReplacingOriginal() {
return true; }
16444 bool AllowSkippingCXXConstructExpr() {
16445 bool Res = AllowSkippingFirstCXXConstructExpr;
16446 AllowSkippingFirstCXXConstructExpr =
true;
16449 bool AllowSkippingFirstCXXConstructExpr =
true;
16459 if (isa<CXXConstructExpr>(It->getPointer()->IgnoreImplicit()))
16460 Transformer.AllowSkippingFirstCXXConstructExpr =
false;
16462 ExprResult Res = Transformer.TransformExpr(It->getPointer()->getSubExpr());
16465 It->getPointer()->setSubExpr(Res.
get());
16496 llvm::SmallPtrSetImpl<DeclRefExpr *> &DRSet;
16497 SimpleRemove(llvm::SmallPtrSetImpl<DeclRefExpr *> &S) : DRSet(S) {}
16500 return DRSet.size();
16503 Visitor.TraverseStmt(
16511 SemaRef.
Diag(DR->getBeginLoc(), diag::err_invalid_consteval_take_address)
16513 SemaRef.
Diag(FD->getLocation(), diag::note_declared_at);
16530 D = diag::err_lambda_unevaluated_operand;
16536 D = diag::err_lambda_in_constant_expression;
16537 }
else if (Rec.
ExprContext == ExpressionKind::EK_TemplateArgument) {
16540 D = diag::err_lambda_in_invalid_context;
16542 llvm_unreachable(
"Couldn't infer lambda error message.");
16544 for (
const auto *L : Rec.
Lambdas)
16545 Diag(L->getBeginLoc(), D);
16556 Diag(BO->getBeginLoc(), diag::warn_deprecated_simple_assign_volatile)
16627 llvm_unreachable(
"Invalid context");
16636 if (!TT.isOSWindows() || !TT.isX86())
16674 : FD(FD), Param(Param) {}
16681 CCName =
"stdcall";
16684 CCName =
"fastcall";
16687 CCName =
"vectorcall";
16690 llvm_unreachable(
"CC does not need mangling");
16693 S.
Diag(Loc, diag::err_cconv_incomplete_param_type)
16694 << Param->getDeclName() << FD->
getDeclName() << CCName;
16699 ParamIncompleteTypeDiagnoser Diagnoser(FD, Param);
16705enum class OdrUseContext {
16727 return OdrUseContext::None;
16731 Result = OdrUseContext::Used;
16735 Result = OdrUseContext::FormallyOdrUsed;
16741 Result = OdrUseContext::FormallyOdrUsed;
16746 return OdrUseContext::Dependent;
16757 auto *CCD = dyn_cast<CXXConstructorDecl>(Func);
16758 return CCD && CCD->getInheritedConstructor();
16764 bool MightBeOdrUse) {
16765 assert(Func &&
"No function?");
16780 OdrUseContext OdrUse =
16782 if (IsRecursiveCall && OdrUse == OdrUseContext::Used)
16783 OdrUse = OdrUseContext::FormallyOdrUsed;
16788 OdrUse == OdrUseContext::Used) {
16789 if (
auto *Constructor = dyn_cast<CXXConstructorDecl>(Func))
16790 if (Constructor->isDefaultConstructor())
16791 OdrUse = OdrUseContext::FormallyOdrUsed;
16792 if (isa<CXXDestructorDecl>(Func))
16793 OdrUse = OdrUseContext::FormallyOdrUsed;
16800 bool NeededForConstantEvaluation =
16825 bool NeedDefinition = !IsRecursiveCall && (OdrUse == OdrUseContext::Used ||
16826 NeededForConstantEvaluation);
16833 if (NeedDefinition &&
16845 if (NeedDefinition && !Func->
getBody()) {
16848 dyn_cast<CXXConstructorDecl>(Func)) {
16850 if (Constructor->isDefaulted() && !Constructor->isDeleted()) {
16851 if (Constructor->isDefaultConstructor()) {
16852 if (Constructor->isTrivial() &&
16856 }
else if (Constructor->isCopyConstructor()) {
16858 }
else if (Constructor->isMoveConstructor()) {
16861 }
else if (Constructor->getInheritedConstructor()) {
16865 dyn_cast<CXXDestructorDecl>(Func)) {
16867 if (Destructor->isDefaulted() && !Destructor->isDeleted()) {
16868 if (Destructor->isTrivial() && !Destructor->hasAttr<
DLLExportAttr>())
16872 if (Destructor->isVirtual() &&
getLangOpts().AppleKext)
16874 }
else if (
CXXMethodDecl *MethodDecl = dyn_cast<CXXMethodDecl>(Func)) {
16875 if (MethodDecl->isOverloadedOperator() &&
16876 MethodDecl->getOverloadedOperator() == OO_Equal) {
16878 if (MethodDecl->isDefaulted() && !MethodDecl->isDeleted()) {
16879 if (MethodDecl->isCopyAssignmentOperator())
16881 else if (MethodDecl->isMoveAssignmentOperator())
16884 }
else if (isa<CXXConversionDecl>(MethodDecl) &&
16885 MethodDecl->getParent()->isLambda()) {
16892 }
else if (MethodDecl->isVirtual() &&
getLangOpts().AppleKext)
16908 bool FirstInstantiation = PointOfInstantiation.
isInvalid();
16909 if (FirstInstantiation) {
16910 PointOfInstantiation = Loc;
16912 MSI->setPointOfInstantiation(Loc);
16920 PointOfInstantiation = Loc;
16929 std::make_pair(Func, PointOfInstantiation));
16938 std::make_pair(Func, PointOfInstantiation));
16945 for (
auto i : Func->
redecls()) {
16946 if (!i->isUsed(
false) && i->isImplicitlyInstantiable())
16967 if (OdrUse == OdrUseContext::Used && !Func->
isUsed(
false)) {
16970 if (mightHaveNonExternalLinkage(Func))
16993 if (
auto *Dtor = dyn_cast<CXXDestructorDecl>(Func)) {
16995 if (
Parent->getNumVBases() > 0 && !Dtor->getBody())
17013 const unsigned *
const FunctionScopeIndexToStopAt =
nullptr) {
17024 QualType CaptureType, DeclRefType;
17030 CaptureType, DeclRefType,
17031 FunctionScopeIndexToStopAt);
17038 unsigned CapturingScopeIndex) {
17050 if (isa<ParmVarDecl>(var) &&
17051 isa<TranslationUnitDecl>(VarDC))
17065 unsigned ContextKind = 3;
17066 if (isa<CXXMethodDecl>(VarDC) &&
17067 cast<CXXRecordDecl>(VarDC->
getParent())->isLambda()) {
17069 }
else if (isa<FunctionDecl>(VarDC)) {
17071 }
else if (isa<BlockDecl>(VarDC)) {
17075 S.
Diag(loc, diag::err_reference_to_local_in_enclosing_context)
17076 << var << ValueKind << ContextKind << VarDC;
17086 bool &SubCapturesAreNested,
17092 SubCapturesAreNested =
true;
17105 !(isa<LambdaScopeInfo>(CSI) && cast<LambdaScopeInfo>(CSI)->Mutable) &&
17106 !(isa<CapturedRegionScopeInfo>(CSI) &&
17107 cast<CapturedRegionScopeInfo>(CSI)->CapRegionKind ==
CR_OpenMP))
17144 S.
Diag(Loc, diag::err_lambda_capture_anonymous_var);
17153 S.
Diag(Loc, diag::err_ref_vm_type);
17161 if (VTTy->getDecl()->hasFlexibleArrayMember()) {
17164 S.
Diag(Loc, diag::err_ref_flexarray_type);
17166 S.
Diag(Loc, diag::err_lambda_capture_flexarray_type) << Var;
17175 if (HasBlocksAttr && (IsLambda || isa<CapturedRegionScopeInfo>(CSI))) {
17177 S.
Diag(Loc, diag::err_capture_block_variable) << Var << !IsLambda;
17186 S.
Diag(Loc, diag::err_opencl_block_ref_block);
17196 const bool BuildAndDiagnose,
17200 Sema &S,
bool Invalid) {
17201 bool ByRef =
false;
17207 if (BuildAndDiagnose) {
17208 S.
Diag(Loc, diag::err_ref_array_type);
17219 if (BuildAndDiagnose) {
17220 S.
Diag(Loc, diag::err_arc_autoreleasing_capture)
17236 if (BuildAndDiagnose) {
17238 S.
Diag(Loc, diag::warn_block_capture_autoreleasing);
17239 S.
Diag(VarLoc, diag::note_declare_parameter_strong);
17253 DeclRefType = CaptureType;
17257 if (BuildAndDiagnose)
17259 CaptureType, Invalid);
17269 const bool BuildAndDiagnose,
17272 const bool RefersToCapturedVariable,
17273 Sema &S,
bool Invalid) {
17296 CaptureType = DeclRefType;
17299 if (BuildAndDiagnose)
17300 RSI->
addCapture(Var,
false, ByRef, RefersToCapturedVariable,
17310 const bool BuildAndDiagnose,
17313 const bool RefersToCapturedVariable,
17316 const bool IsTopScope,
17317 Sema &S,
bool Invalid) {
17319 bool ByRef =
false;
17323 ByRef = (LSI->
ImpCaptureStyle == LambdaScopeInfo::ImpCap_LambdaByref);
17353 if (!RefType->getPointeeType()->isFunctionType())
17360 if (BuildAndDiagnose) {
17361 S.
Diag(Loc, diag::err_arc_autoreleasing_capture) << 1;
17371 if (!Invalid && BuildAndDiagnose) {
17375 diag::err_capture_of_incomplete_or_sizeless_type,
17379 diag::err_capture_of_abstract_type))
17399 if (BuildAndDiagnose)
17400 LSI->
addCapture(Var,
false, ByRef, RefersToCapturedVariable,
17401 Loc, EllipsisLoc, CaptureType, Invalid);
17409 QualType &DeclRefType,
const unsigned *
const FunctionScopeIndexToStopAt) {
17417 const unsigned MaxFunctionScopesIndex = FunctionScopeIndexToStopAt
17421 if (FunctionScopeIndexToStopAt) {
17423 while (FSIndex != MaxFunctionScopesIndex) {
17432 if (VarDC == DC)
return true;
17439 MaxFunctionScopesIndex)))
17451 CaptureType = Var->
getType();
17453 bool Nested =
false;
17455 unsigned FunctionScopesIndex = MaxFunctionScopesIndex;
17468 FunctionScopesIndex = MaxFunctionScopesIndex - 1;
17489 if (BuildAndDiagnose) {
17492 Diag(ExprLoc, diag::err_lambda_impcap) << Var;
17506 if (
ParmVarDecl *PVD = dyn_cast_or_null<ParmVarDecl>(Var))
17507 QTy = PVD->getOriginalType();
17512 if (
auto *RSI = dyn_cast<CapturedRegionScopeInfo>(CSI)) {
17518 Var, RSI->OpenMPLevel, RSI->OpenMPCaptureLevel);
17523 if (IsOpenMPPrivateDecl != OMPC_unknown &&
17526 if (
ParmVarDecl *PVD = dyn_cast_or_null<ParmVarDecl>(Var))
17527 QTy = PVD->getOriginalType();
17528 for (
int I = 1, E = getNumberOfConstructScopes(RSI->OpenMPLevel);
17532 assert(RSI->OpenMPLevel == OuterRSI->OpenMPLevel &&
17533 "Wrong number of captured regions associated with the "
17534 "OpenMP construct.");
17539 IsOpenMPPrivateDecl != OMPC_private &&
17541 RSI->OpenMPCaptureLevel);
17545 RSI->OpenMPCaptureLevel);
17551 adjustOpenMPTargetScopeIndex(FunctionScopesIndex, RSI->OpenMPLevel);
17553 if (IsTargetCap || IsOpenMPPrivateDecl == OMPC_private ||
17554 (IsGlobal && !IsGlobalCap)) {
17555 Nested = !IsTargetCap;
17570 if (BuildAndDiagnose) {
17571 Diag(ExprLoc, diag::err_lambda_impcap) << Var;
17573 if (cast<LambdaScopeInfo>(CSI)->Lambda)
17574 Diag(cast<LambdaScopeInfo>(CSI)->Lambda->getBeginLoc(),
17575 diag::note_lambda_decl);
17591 FunctionScopesIndex--;
17594 }
while (!VarDC->
Equals(DC));
17601 bool Invalid =
false;
17602 for (
unsigned I = ++FunctionScopesIndex,
N = MaxFunctionScopesIndex + 1; I !=
N;
17615 if (Invalid && !BuildAndDiagnose)
17619 Invalid = !
captureInBlock(BSI, Var, ExprLoc, BuildAndDiagnose, CaptureType,
17620 DeclRefType, Nested, *
this, Invalid);
17624 CaptureType, DeclRefType, Nested,
17631 DeclRefType, Nested, Kind, EllipsisLoc,
17632 I ==
N - 1, *
this, Invalid);
17636 if (Invalid && !BuildAndDiagnose)
17648 DeclRefType,
nullptr);
17655 false, CaptureType,
17656 DeclRefType,
nullptr);
17665 false, CaptureType,
17666 DeclRefType,
nullptr))
17669 return DeclRefType;
17677class CopiedTemplateArgs {
17681 template<
typename RefExpr>
17682 CopiedTemplateArgs(RefExpr *E) : HasArgs(E->hasExplicitTemplateArgs()) {
17684 E->copyTemplateArgumentsInto(TemplateArgStorage);
17687#ifdef __has_cpp_attribute
17688#if __has_cpp_attribute(clang::lifetimebound)
17689 [[clang::lifetimebound]]
17693 return HasArgs ? &TemplateArgStorage :
nullptr;
17719 auto Rebuild = [&](
Expr *Sub) {
17724 auto IsPotentialResultOdrUsed = [&](
NamedDecl *D) {
17727 auto *VD = dyn_cast<VarDecl>(D);
17750 llvm_unreachable(
"unexpected non-odr-use-reason");
17754 if (VD->getType()->isReferenceType())
17756 if (
auto *RD = VD->getType()->getAsCXXRecordDecl())
17757 if (RD->hasMutableFields())
17759 if (!VD->isUsableInConstantExpressions(S.
Context))
17764 if (VD->getType()->isReferenceType())
17772 auto MarkNotOdrUsed = [&] {
17775 LSI->markVariableExprAsNonODRUsed(E);
17782 case Expr::DeclRefExprClass: {
17784 if (DRE->isNonOdrUse() || IsPotentialResultOdrUsed(DRE->getDecl()))
17790 S.
Context, DRE->getQualifierLoc(), DRE->getTemplateKeywordLoc(),
17791 DRE->getDecl(), DRE->refersToEnclosingVariableOrCapture(),
17792 DRE->getNameInfo(), DRE->getType(), DRE->getValueKind(),
17793 DRE->getFoundDecl(), CopiedTemplateArgs(DRE), NOUR);
17796 case Expr::FunctionParmPackExprClass: {
17801 if (IsPotentialResultOdrUsed(D))
17812 case Expr::ArraySubscriptExprClass: {
17818 if (!
Base.isUsable())
17820 Expr *LHS = ASE->getBase() == ASE->getLHS() ?
Base.get() : ASE->getLHS();
17821 Expr *RHS = ASE->getBase() == ASE->getRHS() ?
Base.get() : ASE->getRHS();
17824 ASE->getRBracketLoc());
17827 case Expr::MemberExprClass: {
17831 if (isa<FieldDecl>(ME->getMemberDecl())) {
17833 if (!
Base.isUsable())
17836 S.
Context,
Base.get(), ME->isArrow(), ME->getOperatorLoc(),
17837 ME->getQualifierLoc(), ME->getTemplateKeywordLoc(),
17838 ME->getMemberDecl(), ME->getFoundDecl(), ME->getMemberNameInfo(),
17839 CopiedTemplateArgs(ME), ME->getType(), ME->getValueKind(),
17840 ME->getObjectKind(), ME->isNonOdrUse());
17843 if (ME->getMemberDecl()->isCXXInstanceMember())
17848 if (ME->isNonOdrUse() || IsPotentialResultOdrUsed(ME->getMemberDecl()))
17854 S.
Context, ME->getBase(), ME->isArrow(), ME->getOperatorLoc(),
17855 ME->getQualifierLoc(), ME->getTemplateKeywordLoc(), ME->getMemberDecl(),
17856 ME->getFoundDecl(), ME->getMemberNameInfo(), CopiedTemplateArgs(ME),
17857 ME->getType(), ME->getValueKind(), ME->getObjectKind(), NOUR);
17861 case Expr::BinaryOperatorClass: {
17863 Expr *LHS = BO->getLHS();
17864 Expr *RHS = BO->getRHS();
17866 if (BO->getOpcode() == BO_PtrMemD) {
17868 if (!Sub.isUsable())
17872 }
else if (BO->getOpcode() == BO_Comma) {
17874 if (!Sub.isUsable())
17880 return S.
BuildBinOp(
nullptr, BO->getOperatorLoc(), BO->getOpcode(),
17885 case Expr::ParenExprClass: {
17888 if (!Sub.isUsable())
17890 return S.
ActOnParenExpr(PE->getLParen(), PE->getRParen(), Sub.get());
17895 case Expr::ConditionalOperatorClass: {
17906 LHS = CO->getLHS();
17908 RHS = CO->getRHS();
17910 CO->getCond(), LHS.
get(), RHS.
get());
17915 case Expr::UnaryOperatorClass: {
17917 if (UO->getOpcode() != UO_Extension)
17920 if (!Sub.isUsable())
17922 return S.
BuildUnaryOp(
nullptr, UO->getOperatorLoc(), UO_Extension,
17929 case Expr::GenericSelectionExprClass: {
17933 bool AnyChanged =
false;
17934 for (
Expr *OrigAssocExpr : GSE->getAssocExprs()) {
17935 ExprResult AssocExpr = Rebuild(OrigAssocExpr);
17939 AssocExprs.push_back(AssocExpr.
get());
17942 AssocExprs.push_back(OrigAssocExpr);
17947 GSE->getGenericLoc(), GSE->getDefaultLoc(),
17948 GSE->getRParenLoc(), GSE->getControllingExpr(),
17949 GSE->getAssocTypeSourceInfos(), AssocExprs)
17957 case Expr::ChooseExprClass: {
17968 if (!LHS.
get() && !RHS.
get())
17971 LHS = CE->getLHS();
17973 RHS = CE->getRHS();
17976 RHS.
get(), CE->getRParenLoc());
17980 case Expr::ConstantExprClass: {
17983 if (!Sub.isUsable())
17990 case Expr::ImplicitCastExprClass: {
17995 switch (ICE->getCastKind()) {
17997 case CK_DerivedToBase:
17998 case CK_UncheckedDerivedToBase: {
17999 ExprResult Sub = Rebuild(ICE->getSubExpr());
18000 if (!Sub.isUsable())
18004 ICE->getValueKind(), &Path);
18063 for (
Expr *E : LocalMaybeODRUseExprs) {
18064 if (
auto *DRE = dyn_cast<DeclRefExpr>(E)) {
18066 DRE->getLocation(), *
this);
18067 }
else if (
auto *ME = dyn_cast<MemberExpr>(E)) {
18070 }
else if (
auto *FP = dyn_cast<FunctionParmPackExpr>(E)) {
18074 llvm_unreachable(
"Unexpected expression");
18079 "MarkVarDeclODRUsed failed to cleanup MaybeODRUseExprs?");
18084 assert((!E || isa<DeclRefExpr>(E) || isa<MemberExpr>(E) ||
18085 isa<FunctionParmPackExpr>(E)) &&
18086 "Invalid Expr argument to DoMarkVarDeclReferenced");
18115 bool UsableInConstantExpr =
18123 bool NeededForConstantEvaluation =
18126 bool NeedDefinition =
18127 OdrUse == OdrUseContext::Used || NeededForConstantEvaluation;
18129 assert(!isa<VarTemplatePartialSpecializationDecl>(Var) &&
18130 "Can't instantiate a partial template specialization.");
18136 !isa<VarTemplateSpecializationDecl>(Var))
18147 bool TryInstantiating =
18151 if (TryInstantiating) {
18154 bool FirstInstantiation = PointOfInstantiation.
isInvalid();
18155 if (FirstInstantiation) {
18156 PointOfInstantiation = Loc;
18158 MSI->setPointOfInstantiation(PointOfInstantiation);
18164 if (UsableInConstantExpr) {
18173 if (
auto *DRE = dyn_cast_or_null<DeclRefExpr>(E))
18174 DRE->setDecl(DRE->getDecl());
18175 else if (
auto *ME = dyn_cast_or_null<MemberExpr>(E))
18176 ME->setMemberDecl(ME->getMemberDecl());
18177 }
else if (FirstInstantiation ||
18178 isa<VarTemplateSpecializationDecl>(Var)) {
18185 .push_back(std::make_pair(Var, PointOfInstantiation));
18209 if (
DeclRefExpr *DRE = dyn_cast_or_null<DeclRefExpr>(E))
18210 if (DRE->isNonOdrUse())
18212 if (
MemberExpr *ME = dyn_cast_or_null<MemberExpr>(E))
18213 if (ME->isNonOdrUse())
18217 case OdrUseContext::None:
18218 assert((!E || isa<FunctionParmPackExpr>(E)) &&
18219 "missing non-odr-use marking for unevaluated decl ref");
18222 case OdrUseContext::FormallyOdrUsed:
18227 case OdrUseContext::Used:
18236 case OdrUseContext::Dependent:
18241 const bool RefersToEnclosingScope =
18244 if (RefersToEnclosingScope) {
18259 assert(E &&
"Capture variable should be used in an expression.");
18277 Decl *D,
Expr *E,
bool MightBeOdrUse) {
18281 if (
VarDecl *Var = dyn_cast<VarDecl>(D)) {
18290 const MemberExpr *ME = dyn_cast<MemberExpr>(E);
18297 bool IsVirtualCall = MD->
isVirtual() &&
18299 if (!IsVirtualCall)
18318 bool OdrUse =
true;
18320 if (Method->isVirtual() &&
18324 if (
auto *FD = dyn_cast<FunctionDecl>(E->
getDecl()))
18339 bool MightBeOdrUse =
true;
18342 if (Method->isPure())
18343 MightBeOdrUse =
false;
18361 bool MightBeOdrUse) {
18362 if (MightBeOdrUse) {
18363 if (
auto *VD = dyn_cast<VarDecl>(D)) {
18368 if (
auto *FD = dyn_cast<FunctionDecl>(D)) {
18396bool MarkReferencedDecls::TraverseTemplateArgument(
18410 return Inherited::TraverseTemplateArgument(Arg);
18414 MarkReferencedDecls Marker(*
this, Loc);
18415 Marker.TraverseType(T);
18421class EvaluatedExprMarker :
public UsedDeclVisitor<EvaluatedExprMarker> {
18424 bool SkipLocalVariables;
18426 EvaluatedExprMarker(
Sema &S,
bool SkipLocalVariables)
18427 : Inherited(S), SkipLocalVariables(SkipLocalVariables) {}
18435 if (SkipLocalVariables) {
18437 if (VD->hasLocalStorage())
18460 bool SkipLocalVariables) {
18461 EvaluatedExprMarker(*
this, SkipLocalVariables).Visit(E);
18507 if (
auto *VD = dyn_cast_or_null<VarDecl>(
18509 if (VD->isConstexpr() ||
18510 (VD->isStaticDataMember() && VD->isFirstDecl() && !VD->isInline()))
18526 Loc, Statement ? llvm::makeArrayRef(Statement) : llvm::None, PD);
18542 class CallReturnIncompleteDiagnoser :
public TypeDiagnoser {
18548 : FD(FD), CE(CE) { }
18552 S.
Diag(Loc, diag::err_call_incomplete_return)
18557 S.
Diag(Loc, diag::err_call_function_incomplete_return)
18562 } Diagnoser(FD, CE);
18575 unsigned diagnostic = diag::warn_condition_is_assignment;
18576 bool IsOrAssign =
false;
18579 if (Op->getOpcode() != BO_Assign && Op->getOpcode() != BO_OrAssign)
18582 IsOrAssign = Op->getOpcode() == BO_OrAssign;
18591 diagnostic = diag::warn_condition_is_idiomatic_assignment;
18595 diagnostic = diag::warn_condition_is_idiomatic_assignment;
18598 Loc = Op->getOperatorLoc();
18600 if (Op->getOperator() != OO_Equal && Op->getOperator() != OO_PipeEqual)
18603 IsOrAssign = Op->getOperator() == OO_PipeEqual;
18604 Loc = Op->getOperatorLoc();
18616 Diag(Loc, diag::note_condition_assign_silence)
18621 Diag(Loc, diag::note_condition_or_assign_to_comparison)
18624 Diag(Loc, diag::note_condition_assign_to_comparison)
18642 if (opE->getOpcode() == BO_EQ &&
18643 opE->getLHS()->IgnoreParenImpCasts()->isModifiableLvalue(
Context)
18649 Diag(Loc, diag::note_equality_comparison_silence)
18652 Diag(Loc, diag::note_equality_comparison_to_assign)
18658 bool IsConstexpr) {
18660 if (
ParenExpr *parenE = dyn_cast<ParenExpr>(E))
18677 if (!T->isScalarType()) {
18678 Diag(Loc, diag::err_typecheck_statement_requires_scalar)
18682 CheckBoolLikeConversion(E, Loc);
18726 struct RebuildUnknownAnyFunction
18727 :
StmtVisitor<RebuildUnknownAnyFunction, ExprResult> {
18731 RebuildUnknownAnyFunction(
Sema &S) : S(S) {}
18734 llvm_unreachable(
"unexpected statement!");
18745 template <
class T>
ExprResult rebuildSugarExpr(T *E) {
18746 ExprResult SubResult = Visit(E->getSubExpr());
18749 Expr *SubExpr = SubResult.
get();
18750 E->setSubExpr(SubExpr);
18751 E->setType(SubExpr->
getType());
18758 return rebuildSugarExpr(E);
18762 return rebuildSugarExpr(E);
18769 Expr *SubExpr = SubResult.
get();
18778 if (!isa<FunctionDecl>(VD))
return VisitExpr(E);
18784 !(isa<CXXMethodDecl>(VD) &&
18785 cast<CXXMethodDecl>(VD)->isInstance()))
18796 return resolveDecl(E, E->
getDecl());
18814 struct RebuildUnknownAnyExpr
18815 :
StmtVisitor<RebuildUnknownAnyExpr, ExprResult> {
18826 llvm_unreachable(
"unexpected statement!");
18840 template <
class T>
ExprResult rebuildSugarExpr(T *E) {
18841 ExprResult SubResult = Visit(E->getSubExpr());
18843 Expr *SubExpr = SubResult.
get();
18844 E->setSubExpr(SubExpr);
18845 E->setType(SubExpr->
getType());
18852 return rebuildSugarExpr(E);
18856 return rebuildSugarExpr(E);
18894 return resolveDecl(E, E->
getDecl());
18905 FK_FunctionPointer,
18912 assert(isa<CXXMemberCallExpr>(E) || isa<CXXOperatorCallExpr>(E));
18913 Kind = FK_MemberFunction;
18917 Kind = FK_FunctionPointer;
18920 Kind = FK_BlockPointer;
18926 unsigned diagID = diag::err_func_returning_array_function;
18927 if (Kind == FK_BlockPointer)
18928 diagID = diag::err_block_returning_array_function;
18964 if (ParamTypes.empty() && Proto->
isVariadic()) {
18966 for (
unsigned i = 0, e = E->
getNumArgs(); i != e; ++i) {
18974 ArgTypes.push_back(ArgType);
18976 ParamTypes = ArgTypes;
18987 case FK_MemberFunction:
18991 case FK_FunctionPointer:
18995 case FK_BlockPointer:
19001 ExprResult CalleeResult = Visit(CalleeExpr);
19012 S.
Diag(E->
getExprLoc(), diag::err_func_returning_array_function)
19020 Method->setReturnType(DestType);
19032 if (E->
getCastKind() == CK_FunctionToPointerDecay) {
19046 }
else if (E->
getCastKind() == CK_LValueToRValue) {
19050 assert(isa<BlockPointerType>(E->
getType()));
19063 llvm_unreachable(
"Unhandled cast type!");
19096 if (DRE && Proto && Proto->getParamTypes().empty() && Proto->isVariadic()) {
19099 S.
Context, FD->getDeclContext(), Loc, Loc,
19100 FD->getNameInfo().getName(), DestType, FD->getTypeSourceInfo(),
19101 SC_None,
false , FD->hasPrototype(),
19104 if (FD->getQualifier())
19108 for (
const auto &AI : FT->param_types()) {
19112 Params.push_back(Param);
19114 NewFD->setParams(Params);
19121 if (MD->isInstance()) {
19131 }
else if (isa<VarDecl>(VD)) {
19135 S.
Diag(E->
getExprLoc(), diag::err_unknown_any_var_function_type)
19163 diag::err_typecheck_cast_to_incomplete))
19178 return RebuildUnknownAnyExpr(*
this, ToType).Visit(E);
19185 ExplicitCastExpr *castArg = dyn_cast<ExplicitCastExpr>(arg->IgnoreParens());
19194 assert(!arg->hasPlaceholderType());
19206 unsigned diagID = diag::err_uncasted_use_of_unknown_any;
19209 if (
CallExpr *call = dyn_cast<CallExpr>(E)) {
19210 E = call->getCallee();
19211 diagID = diag::err_uncasted_call_of_unknown_any;
19219 if (
DeclRefExpr *ref = dyn_cast<DeclRefExpr>(E)) {
19220 loc = ref->getLocation();
19221 d = ref->getDecl();
19222 }
else if (
MemberExpr *mem = dyn_cast<MemberExpr>(E)) {
19223 loc = mem->getMemberLoc();
19224 d = mem->getMemberDecl();
19226 diagID = diag::err_uncasted_call_of_unknown_any;
19227 loc = msg->getSelectorStartLoc();
19228 d = msg->getMethodDecl();
19230 S.
Diag(loc, diag::err_uncasted_send_to_unknown_any_method)
19231 <<
static_cast<unsigned>(msg->isClassMessage()) << msg->getSelector()
19260 if (!placeholderType)
return E;
19262 switch (placeholderType->
getKind()) {
19265 case BuiltinType::Overload: {
19285 case BuiltinType::BoundMember: {
19290 if (isa<CXXPseudoDestructorExpr>(BME)) {
19291 PD =
PDiag(diag::err_dtor_expr_without_call) << 1;
19292 }
else if (
const auto *ME = dyn_cast<MemberExpr>(BME)) {
19293 if (ME->getMemberNameInfo().getName().getNameKind() ==
19295 PD =
PDiag(diag::err_dtor_expr_without_call) << 0;
19303 case BuiltinType::ARCUnbridgedCast: {
19310 case BuiltinType::UnknownAny:
19314 case BuiltinType::PseudoObject:
19317 case BuiltinType::BuiltinFn: {
19322 if (FD->getBuiltinID() == Builtin::BI__noop) {
19324 CK_BuiltinFnToFnPtr)
19336 case BuiltinType::IncompleteMatrixIdx:
19340 diag::err_matrix_incomplete_index);
19344 case BuiltinType::OMPArraySection:
19349 case BuiltinType::OMPArrayShaping:
19352 case BuiltinType::OMPIterator:
19356#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
19357 case BuiltinType::Id:
19358#include "clang/Basic/OpenCLImageTypes.def"
19359#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
19360 case BuiltinType::Id:
19361#include "clang/Basic/OpenCLExtensionTypes.def"
19362#define SVE_TYPE(Name, Id, SingletonId) \
19363 case BuiltinType::Id:
19364#include "clang/Basic/AArch64SVEACLETypes.def"
19365#define PPC_VECTOR_TYPE(Name, Id, Size) \
19366 case BuiltinType::Id:
19367#include "clang/Basic/PPCTypes.def"
19368#define BUILTIN_TYPE(Id, SingletonId) case BuiltinType::Id:
19369#define PLACEHOLDER_TYPE(Id, SingletonId)
19370#include "clang/AST/BuiltinTypes.def"
19374 llvm_unreachable(
"invalid placeholder type!");
19388 assert((Kind == tok::kw___objc_yes || Kind == tok::kw___objc_no) &&
19389 "Unknown Objective-C Boolean value!");
19416 VersionTuple Version;
19417 if (Spec != AvailSpecs.end())
Defines the clang::ASTContext interface.
This file provides some common utility functions for processing Lambda related AST Constructs.
static unsigned isEnabled(DiagnosticsEngine &D, unsigned diag)
Defines enum values for all the target-independent builtin functions.
This file defines the classes used to store parsed information about declaration-specifiers and decla...
Defines the C++ template declaration subclasses.
Defines the classes clang::DelayedDiagnostic and clang::AccessedEntity.
Defines the clang::Expr interface and subclasses for C++ expressions.
static DiagnosticBuilder Diag(DiagnosticsEngine *Diags, const LangOptions &Features, FullSourceLoc TokLoc, const char *TokBegin, const char *TokRangeBegin, const char *TokRangeEnd, unsigned DiagID)
Produce a diagnostic highlighting some portion of a literal.
Implements a partial diagnostic that can be emitted anwyhere in a DiagnosticBuilder stream.
Defines the clang::Preprocessor interface.
static std::string getName(const CallEvent &Call)
static bool hasAttr(const FunctionDecl *D, bool IgnoreImplicitAttr)
static Sema::AssignConvertType checkObjCPointerTypesForAssignment(Sema &S, QualType LHSType, QualType RHSType)
checkObjCPointerTypesForAssignment - Compares two objective-c pointer types for assignment compatibil...
static void HandleImmediateInvocations(Sema &SemaRef, Sema::ExpressionEvaluationContextRecord &Rec)
static ExprResult BuildCookedLiteralOperatorCall(Sema &S, Scope *Scope, IdentifierInfo *UDSuffix, SourceLocation UDSuffixLoc, ArrayRef< Expr * > Args, SourceLocation LitEndLoc)
BuildCookedLiteralOperatorCall - A user-defined literal was found.
static ExprResult BuildOverloadedBinOp(Sema &S, Scope *Sc, SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHS, Expr *RHS)
Build an overloaded binary operator expression in the given scope.
static bool canConvertIntTyToFloatTy(Sema &S, ExprResult *Int, QualType FloatTy)
Test if a (constant) integer Int can be casted to floating point type FloatTy without losing precisio...
static bool captureInCapturedRegion(CapturedRegionScopeInfo *RSI, VarDecl *Var, SourceLocation Loc, const bool BuildAndDiagnose, QualType &CaptureType, QualType &DeclRefType, const bool RefersToCapturedVariable, Sema &S, bool Invalid)
Capture the given variable in the captured region.
static bool checkArithmeticOpPointerOperand(Sema &S, SourceLocation Loc, Expr *Operand)
Check the validity of an arithmetic pointer operand.
static void DiagnoseBitwisePrecedence(Sema &Self, BinaryOperatorKind Opc, SourceLocation OpLoc, Expr *LHSExpr, Expr *RHSExpr)
DiagnoseBitwisePrecedence - Emit a warning when bitwise and comparison operators are mixed in a way t...
static bool isPlaceholderToRemoveAsArg(QualType type)
Is the given type a placeholder that we need to lower out immediately during argument processing?
static void diagnoseArithmeticOnNullPointer(Sema &S, SourceLocation Loc, Expr *Pointer, bool IsGNUIdiom)
Diagnose invalid arithmetic on a null pointer.
static QualType checkConditionalObjectPointersCompatibility(Sema &S, ExprResult &LHS, ExprResult &RHS, SourceLocation Loc)
Return the resulting type when the operands are both pointers.
static QualType OpenCLCheckVectorConditional(Sema &S, ExprResult &Cond, ExprResult &LHS, ExprResult &RHS, SourceLocation QuestionLoc)
Return the resulting type for the conditional operator in OpenCL (aka "ternary selection operator",...
static void diagnoseLogicalNotOnLHSofCheck(Sema &S, ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc)
Warns on !x < y, !x & y where !(x < y), !(x & y) was probably intended.
static void diagnoseArithmeticOnFunctionPointer(Sema &S, SourceLocation Loc, Expr *Pointer)
Diagnose invalid arithmetic on a function pointer.
static bool isVariableCapturable(CapturingScopeInfo *CSI, VarDecl *Var, SourceLocation Loc, const bool Diagnose, Sema &S)
static void diagnoseObjCLiteralComparison(Sema &S, SourceLocation Loc, ExprResult &LHS, ExprResult &RHS, BinaryOperator::Opcode Opc)
static QualType handleComplexFloatConversion(Sema &S, ExprResult &LHS, ExprResult &RHS, QualType LHSType, QualType RHSType, bool IsCompAssign)
Handle arithmetic conversion with complex types.
static bool isCapturingReferenceToHostVarInCUDADeviceLambda(const Sema &S, VarDecl *VD)
static UnaryOperatorKind ConvertTokenKindToUnaryOpcode(tok::TokenKind Kind)
static bool isImplicitlyDefinableConstexprFunction(FunctionDecl *Func)
NonConstCaptureKind
Is the given expression (which must be 'const') a reference to a variable which was originally non-co...
static bool tryVectorConvertAndSplat(Sema &S, ExprResult *scalar, QualType scalarTy, QualType vectorEltTy, QualType vectorTy, unsigned &DiagID)
Try to convert a value of non-vector type to a vector type by converting the type to the element type...
static bool isVector(QualType QT, QualType ElementType)
This helper function returns true if QT is a vector type that has element type ElementType.
static void DiagnoseCalleeStaticArrayParam(Sema &S, ParmVarDecl *PVD)
static void MarkExprReferenced(Sema &SemaRef, SourceLocation Loc, Decl *D, Expr *E, bool MightBeOdrUse)
static Expr * recoverFromMSUnqualifiedLookup(Sema &S, ASTContext &Context, DeclarationNameInfo &NameInfo, SourceLocation TemplateKWLoc, const TemplateArgumentListInfo *TemplateArgs)
In Microsoft mode, if we are inside a template class whose parent class has dependent base classes,...
static bool IsArithmeticBinaryExpr(Expr *E, BinaryOperatorKind *Opcode, Expr **RHSExprs)
IsArithmeticBinaryExpr - Returns true if E is an arithmetic binary expression, either using a built-i...
static bool isVariableAlreadyCapturedInScopeInfo(CapturingScopeInfo *CSI, VarDecl *Var, bool &SubCapturesAreNested, QualType &CaptureType, QualType &DeclRefType)
static bool maybeDiagnoseAssignmentToFunction(Sema &S, QualType DstType, const Expr *SrcExpr)
static bool IgnoreCommaOperand(const Expr *E)
static void SuggestParentheses(Sema &Self, SourceLocation Loc, const PartialDiagnostic &Note, SourceRange ParenRange)
SuggestParentheses - Emit a note with a fixit hint that wraps ParenRange in parentheses.
static QualType CheckRealImagOperand(Sema &S, ExprResult &V, SourceLocation Loc, bool IsReal)
static QualType checkArithmeticOrEnumeralCompare(Sema &S, ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc)
static bool CheckAlignOfExpr(Sema &S, Expr *E, UnaryExprOrTypeTrait ExprKind)
static bool isPotentiallyConstantEvaluatedContext(Sema &SemaRef)
Are we in a context that is potentially constant evaluated per C++20 [expr.const]p12?
static void DiagnoseSelfAssignment(Sema &S, Expr *LHSExpr, Expr *RHSExpr, SourceLocation OpLoc, bool IsBuiltin)
DiagnoseSelfAssignment - Emits a warning if a value is assigned to itself.
static void diagnoseStringPlusInt(Sema &Self, SourceLocation OpLoc, Expr *LHSExpr, Expr *RHSExpr)
diagnoseStringPlusInt - Emit a warning when adding an integer to a string literal.
static QualType checkConditionalPointerCompatibility(Sema &S, ExprResult &LHS, ExprResult &RHS, SourceLocation Loc)
Checks compatibility between two pointers and return the resulting type.
static bool ShouldLookupResultBeMultiVersionOverload(const LookupResult &R)
static bool checkForArray(const Expr *E)
static Sema::AssignConvertType checkPointerTypesForAssignment(Sema &S, QualType LHSType, QualType RHSType)
static void DiagnoseRecursiveConstFields(Sema &S, const ValueDecl *VD, const RecordType *Ty, SourceLocation Loc, SourceRange Range, OriginalExprKind OEK, bool &DiagnosticEmitted)
static ExprResult convertVector(Expr *E, QualType ElementType, Sema &S)
Convert vector E to a vector with the same number of elements but different element type.
static bool ExprLooksBoolean(Expr *E)
ExprLooksBoolean - Returns true if E looks boolean, i.e.
static void RecordModifiableNonNullParam(Sema &S, const Expr *Exp)
static void EvaluateAndDiagnoseImmediateInvocation(Sema &SemaRef, Sema::ImmediateInvocationCandidate Candidate)
static bool checkThreeWayNarrowingConversion(Sema &S, QualType ToType, Expr *E, QualType FromType, SourceLocation Loc)
static ExprResult convertHalfVecBinOp(Sema &S, ExprResult LHS, ExprResult RHS, BinaryOperatorKind Opc, QualType ResultTy, ExprValueKind VK, ExprObjectKind OK, bool IsCompAssign, SourceLocation OpLoc, FPOptionsOverride FPFeatures)
static QualType handleIntegerConversion(Sema &S, ExprResult &LHS, ExprResult &RHS, QualType LHSType, QualType RHSType, bool IsCompAssign)
Handle integer arithmetic conversions.
static void checkDirectCallValidity(Sema &S, const Expr *Fn, FunctionDecl *Callee, MultiExprArg ArgExprs)
static void ConstructTransparentUnion(Sema &S, ASTContext &C, ExprResult &EResult, QualType UnionType, FieldDecl *Field)
Constructs a transparent union from an expression that is used to initialize the transparent union.
static QualType OpenCLConvertScalarsToVectors(Sema &S, ExprResult &LHS, ExprResult &RHS, QualType CondTy, SourceLocation QuestionLoc)
Convert scalar operands to a vector that matches the condition in length.
static bool checkConditionalNullPointer(Sema &S, ExprResult &NullExpr, QualType PointerTy)
Return false if the NullExpr can be promoted to PointerTy, true otherwise.
static NamedDecl * getDeclFromExpr(Expr *E)
static bool checkArithmeticOnObjCPointer(Sema &S, SourceLocation opLoc, Expr *op)
Diagnose if arithmetic on the given ObjC pointer is illegal.
static bool IsInvalidCmseNSCallConversion(Sema &S, QualType FromType, QualType ToType)
static void RemoveNestedImmediateInvocation(Sema &SemaRef, Sema::ExpressionEvaluationContextRecord &Rec, SmallVector< Sema::ImmediateInvocationCandidate, 4 >::reverse_iterator It)
static void DiagnoseBitwiseOpInBitwiseOp(Sema &S, BinaryOperatorKind Opc, SourceLocation OpLoc, Expr *SubExpr)
Look for bitwise op in the left or right hand of a bitwise op with lower precedence and emit a diagno...
static void emitEmptyLookupTypoDiagnostic(const TypoCorrection &TC, Sema &SemaRef, const CXXScopeSpec &SS, DeclarationName Typo, SourceLocation TypoLoc, ArrayRef< Expr * > Args, unsigned DiagnosticID, unsigned DiagnosticSuggestID)
static QualType CheckIncrementDecrementOperand(Sema &S, Expr *Op, ExprValueKind &VK, ExprObjectKind &OK, SourceLocation OpLoc, bool IsInc, bool IsPrefix)
CheckIncrementDecrementOperand - unlike most "Check" methods, this routine doesn't need to call Usual...
static QualType OpenCLArithmeticConversions(Sema &S, ExprResult &LHS, ExprResult &RHS, SourceLocation QuestionLoc)
Simple conversion between integer and floating point types.
static bool checkVectorResult(Sema &S, QualType CondTy, QualType VecResTy, SourceLocation QuestionLoc)
Return false if the vector condition type and the vector result type are compatible.
static void DiagnoseDivisionSizeofPointerOrArray(Sema &S, Expr *LHS, Expr *RHS, SourceLocation Loc)
static void warnOnSizeofOnArrayDecay(Sema &S, SourceLocation Loc, QualType T, Expr *E)
Check whether E is a pointer from a decayed array type (the decayed pointer type is equal to T) and e...
static void diagnoseTautologicalComparison(Sema &S, SourceLocation Loc, Expr *LHS, Expr *RHS, BinaryOperatorKind Opc)
Diagnose some forms of syntactically-obvious tautological comparison.
static void DiagnoseBadDivideOrRemainderValues(Sema &S, ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsDiv)
static void ConvertUTF8ToWideString(unsigned CharByteWidth, StringRef Source, SmallString< 32 > &Target)
static TypoCorrection TryTypoCorrectionForCall(Sema &S, Expr *Fn, FunctionDecl *FDecl, ArrayRef< Expr * > Args)
static bool hasAnyExplicitStorageClass(const FunctionDecl *D)
Determine whether a FunctionDecl was ever declared with an explicit storage class.
static void DiagnoseBadShiftValues(Sema &S, ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc, QualType LHSType)
static bool CheckDeclInExpr(Sema &S, SourceLocation Loc, NamedDecl *D)
Diagnoses obvious problems with the use of the given declaration as an expression.
static bool CheckVecStepTraitOperandType(Sema &S, QualType T, SourceLocation Loc, SourceRange ArgRange)
static Sema::AssignConvertType checkBlockPointerTypesForAssignment(Sema &S, QualType LHSType, QualType RHSType)
checkBlockPointerTypesForAssignment - This routine determines whether two block pointer types are com...
static bool unsupportedTypeConversion(const Sema &S, QualType LHSType, QualType RHSType)
Diagnose attempts to convert between __float128 and long double if there is no support for such conve...
static void diagnoseStringPlusChar(Sema &Self, SourceLocation OpLoc, Expr *LHSExpr, Expr *RHSExpr)
Emit a warning when adding a char literal to a string.
static bool CheckForModifiableLvalue(Expr *E, SourceLocation Loc, Sema &S)
CheckForModifiableLvalue - Verify that E is a modifiable lvalue.
static ValueDecl * getPrimaryDecl(Expr *E)
getPrimaryDecl - Helper function for CheckAddressOfOperand().
static void diagnoseUseOfInternalDeclInInlineFunction(Sema &S, const NamedDecl *D, SourceLocation Loc)
Check whether we're in an extern inline function and referring to a variable or function with interna...
static bool checkArgsForPlaceholders(Sema &S, MultiExprArg args)
Check an argument list for placeholders that we won't try to handle later.
static bool funcHasParameterSizeMangling(Sema &S, FunctionDecl *FD)
Return true if this function has a calling convention that requires mangling in the size of the param...
static bool convertPointersToCompositeType(Sema &S, SourceLocation Loc, ExprResult &LHS, ExprResult &RHS)
Returns false if the pointers are converted to a composite type, true otherwise.
static void DiagnoseBinOpPrecedence(Sema &Self, BinaryOperatorKind Opc, SourceLocation OpLoc, Expr *LHSExpr, Expr *RHSExpr)
DiagnoseBinOpPrecedence - Emit warnings for expressions with tricky precedence.
static void diagnoseAddressOfInvalidType(Sema &S, SourceLocation Loc, Expr *E, unsigned Type)
Diagnose invalid operand for address of operations.
static QualType handleComplexIntConversion(Sema &S, ExprResult &LHS, ExprResult &RHS, QualType LHSType, QualType RHSType, bool IsCompAssign)
Handle conversions with GCC complex int extension.
static bool isMSPropertySubscriptExpr(Sema &S, Expr *Base)
static bool tryGCCVectorConvertAndSplat(Sema &S, ExprResult *Scalar, ExprResult *Vector)
Attempt to convert and splat Scalar into a vector whose types matches Vector following GCC conversion...
static bool handleIntegerToComplexFloatConversion(Sema &S, ExprResult &IntExpr, ExprResult &ComplexExpr, QualType IntTy, QualType ComplexTy, bool SkipCast)
Converts an integer to complex float type.
static void DiagnoseLogicalAndInLogicalOrLHS(Sema &S, SourceLocation OpLoc, Expr *LHSExpr, Expr *RHSExpr)
Look for '&&' in the left hand of a '||' expr.
static void CheckForNullPointerDereference(Sema &S, Expr *E)
static QualType computeConditionalNullability(QualType ResTy, bool IsBin, QualType LHSTy, QualType RHSTy, ASTContext &Ctx)
Compute the nullability of a conditional expression.
static OdrUseContext isOdrUseContext(Sema &SemaRef)
Are we within a context in which references to resolved functions or to variables result in odr-use?
static void DiagnoseConstAssignment(Sema &S, const Expr *E, SourceLocation Loc)
Emit the "read-only variable not assignable" error and print notes to give more information about why...
static Expr * BuildFloatingLiteral(Sema &S, NumericLiteralParser &Literal, QualType Ty, SourceLocation Loc)
static bool IsTypeModifiable(QualType Ty, bool IsDereference)
static bool checkArithmeticIncompletePointerType(Sema &S, SourceLocation Loc, Expr *Operand)
Emit error if Operand is incomplete pointer type.
static void diagnoseUncapturableValueReference(Sema &S, SourceLocation loc, ValueDecl *var, DeclContext *DC)
static bool CheckExtensionTraitOperandType(Sema &S, QualType T, SourceLocation Loc, SourceRange ArgRange, UnaryExprOrTypeTrait TraitKind)
static QualType checkArithmeticOrEnumeralThreeWayCompare(Sema &S, ExprResult &LHS, ExprResult &RHS, SourceLocation Loc)
static void DiagnoseConditionalPrecedence(Sema &Self, SourceLocation OpLoc, Expr *Condition, Expr *LHSExpr, Expr *RHSExpr)
DiagnoseConditionalPrecedence - Emit a warning when a conditional operator and binary operator are mi...
static ExprResult diagnoseUnknownAnyExpr(Sema &S, Expr *E)
static QualType CheckIndirectionOperand(Sema &S, Expr *Op, ExprValueKind &VK, SourceLocation OpLoc)
CheckIndirectionOperand - Type check unary indirection (prefix '*').
static bool EvaluatesAsTrue(Sema &S, Expr *E)
Returns true if the given expression can be evaluated as a constant 'true'.
static SourceLocation getUDSuffixLoc(Sema &S, SourceLocation TokLoc, unsigned Offset)
getUDSuffixLoc - Create a SourceLocation for a ud-suffix, given the location of the token and the off...
static bool checkBlockType(Sema &S, const Expr *E)
Return true if the Expr is block type.
static QualType handleFloatConversion(Sema &S, ExprResult &LHS, ExprResult &RHS, QualType LHSType, QualType RHSType, bool IsCompAssign)
Handle arithmethic conversion with floating point types.
static void diagnoseArithmeticOnVoidPointer(Sema &S, SourceLocation Loc, Expr *Pointer)
Diagnose invalid arithmetic on a void pointer.
static QualType checkVectorShift(Sema &S, ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign)
Return the resulting type when a vector is shifted by a scalar or vector shift amount.
ExprResult PerformCastFn(Sema &S, Expr *operand, QualType toType)
static DeclContext * getParentOfCapturingContextOrNull(DeclContext *DC, VarDecl *Var, SourceLocation Loc, const bool Diagnose, Sema &S)
static void checkArithmeticNull(Sema &S, ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompare)
static bool IsReadonlyMessage(Expr *E, Sema &S)
static bool captureInLambda(LambdaScopeInfo *LSI, VarDecl *Var, SourceLocation Loc, const bool BuildAndDiagnose, QualType &CaptureType, QualType &DeclRefType, const bool RefersToCapturedVariable, const Sema::TryCaptureKind Kind, SourceLocation EllipsisLoc, const bool IsTopScope, Sema &S, bool Invalid)
Capture the given variable in the lambda.
static void tryImplicitlyCaptureThisIfImplicitMemberFunctionAccessWithDependentArgs(Sema &S, const UnresolvedMemberExpr *const UME, SourceLocation CallLoc)
static void MarkVarDeclODRUsed(VarDecl *Var, SourceLocation Loc, Sema &SemaRef, const unsigned *const FunctionScopeIndexToStopAt=nullptr)
Directly mark a variable odr-used.
static void DiagnoseLogicalAndInLogicalOrRHS(Sema &S, SourceLocation OpLoc, Expr *LHSExpr, Expr *RHSExpr)
Look for '&&' in the right hand of a '||' expr.
static bool checkCondition(Sema &S, Expr *Cond, SourceLocation QuestionLoc)
Return false if the condition expression is valid, true otherwise.
static void checkEnumArithmeticConversions(Sema &S, Expr *LHS, Expr *RHS, SourceLocation Loc, Sema::ArithConvKind ACK)
Check that the usual arithmetic conversions can be performed on this pair of expressions that might b...
static void diagnosePointerIncompatibility(Sema &S, SourceLocation Loc, Expr *LHSExpr, Expr *RHSExpr)
Emit error when two pointers are incompatible.
static void DoMarkVarDeclReferenced(Sema &SemaRef, SourceLocation Loc, VarDecl *Var, Expr *E)
static bool enclosingClassIsRelatedToClassInWhichMembersWereFound(const UnresolvedMemberExpr *const UME, Sema &S)
static unsigned GetFixedPointRank(QualType Ty)
Return the rank of a given fixed point or integer type.
static bool CheckObjCTraitOperandConstraints(Sema &S, QualType T, SourceLocation Loc, SourceRange ArgRange, UnaryExprOrTypeTrait TraitKind)
static void diagnoseArithmeticOnTwoFunctionPointers(Sema &S, SourceLocation Loc, Expr *LHS, Expr *RHS)
Diagnose invalid arithmetic on two function pointers.
static bool checkPointerIntegerMismatch(Sema &S, ExprResult &Int, Expr *PointerExpr, SourceLocation Loc, bool IsIntFirstExpr)
Return false if the first expression is not an integer and the second expression is not a pointer,...
static ImplicitConversionKind castKindToImplicitConversionKind(CastKind CK)
static void diagnoseXorMisusedAsPow(Sema &S, const ExprResult &XorLHS, const ExprResult &XorRHS, const SourceLocation Loc)
static bool checkOpenCLConditionVector(Sema &S, Expr *Cond, SourceLocation QuestionLoc)
Return false if this is a valid OpenCL condition vector.
static bool IsArithmeticOp(BinaryOperatorKind Opc)
static std::pair< ExprResult, ExprResult > CorrectDelayedTyposInBinOp(Sema &S, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr)
static void checkObjCPointerIntrospection(Sema &S, ExprResult &L, ExprResult &R, SourceLocation OpLoc)
Check if a bitwise-& is performed on an Objective-C pointer.
static void DiagnoseDirectIsaAccess(Sema &S, const ObjCIvarRefExpr *OIRE, SourceLocation AssignLoc, const Expr *RHS)
static ExprResult rebuildUnknownAnyFunction(Sema &S, Expr *fn)
Given a function expression of unknown-any type, try to rebuild it to have a function type.
static QualType handleIntToFloatConversion(Sema &S, ExprResult &FloatExpr, ExprResult &IntExpr, QualType FloatTy, QualType IntTy, bool ConvertFloat, bool ConvertInt)
Handle arithmetic conversion from integer to float.
static bool hasIsEqualMethod(Sema &S, const Expr *LHS, const Expr *RHS)
static QualType checkConditionalVoidType(Sema &S, ExprResult &LHS, ExprResult &RHS)
Handle when one or both operands are void type.
static FunctionDecl * rewriteBuiltinFunctionDecl(Sema *Sema, ASTContext &Context, FunctionDecl *FDecl, MultiExprArg ArgExprs)
If a builtin function has a pointer argument with no explicit address space, then it should be able t...
static bool EvaluatesAsFalse(Sema &S, Expr *E)
Returns true if the given expression can be evaluated as a constant 'false'.
static void DiagnoseUnusedOfDecl(Sema &S, NamedDecl *D, SourceLocation Loc)
static QualType handleFixedPointConversion(Sema &S, QualType LHSTy, QualType RHSTy)
handleFixedPointConversion - Fixed point operations between fixed point types and integers or other f...
static QualType CheckCommaOperands(Sema &S, ExprResult &LHS, ExprResult &RHS, SourceLocation Loc)
static void diagnoseArithmeticOnTwoVoidPointers(Sema &S, SourceLocation Loc, Expr *LHSExpr, Expr *RHSExpr)
Diagnose invalid arithmetic on two void pointers.
static void diagnoseDistinctPointerComparison(Sema &S, SourceLocation Loc, ExprResult &LHS, ExprResult &RHS, bool IsError)
Diagnose bad pointer comparisons.
static bool needsConversionOfHalfVec(bool OpRequiresConversion, ASTContext &Ctx, Expr *E0, Expr *E1=nullptr)
Returns true if conversion between vectors of halfs and vectors of floats is needed.
static bool isObjCObjectLiteral(ExprResult &E)
static NonConstCaptureKind isReferenceToNonConstCapture(Sema &S, Expr *E)
static QualType checkConditionalBlockPointerCompatibility(Sema &S, ExprResult &LHS, ExprResult &RHS, SourceLocation Loc)
Return the resulting type when the operands are both block pointers.
static void DiagnoseShiftCompare(Sema &S, SourceLocation OpLoc, Expr *LHSExpr, Expr *RHSExpr)
static void DiagnoseAdditionInShift(Sema &S, SourceLocation OpLoc, Expr *SubExpr, StringRef Shift)
static void diagnoseFunctionPointerToVoidComparison(Sema &S, SourceLocation Loc, ExprResult &LHS, ExprResult &RHS, bool IsError)
static void EmitDiagnosticForLogicalAndInLogicalOr(Sema &Self, SourceLocation OpLoc, BinaryOperator *Bop)
It accepts a '&&' expr that is inside a '||' one.
static bool captureInBlock(BlockScopeInfo *BSI, VarDecl *Var, SourceLocation Loc, const bool BuildAndDiagnose, QualType &CaptureType, QualType &DeclRefType, const bool Nested, Sema &S, bool Invalid)
static void captureVariablyModifiedType(ASTContext &Context, QualType T, CapturingScopeInfo *CSI)
static bool canConvertIntToOtherIntTy(Sema &S, ExprResult *Int, QualType OtherIntTy)
Test if a (constant) integer Int can be casted to another integer type IntTy without losing precision...
static bool isOverflowingIntegerType(ASTContext &Ctx, QualType T)
static void CheckIdentityFieldAssignment(Expr *LHSExpr, Expr *RHSExpr, SourceLocation Loc, Sema &Sema)
static ExprResult rebuildPotentialResultsAsNonOdrUsed(Sema &S, Expr *E, NonOdrUseReason NOUR)
Walk the set of potential results of an expression and mark them all as non-odr-uses if they satisfy ...
static void CheckCompleteParameterTypesForMangler(Sema &S, FunctionDecl *FD, SourceLocation Loc)
Require that all of the parameter types of function be complete.
static bool isScopedEnumerationType(QualType T)
static bool checkArithmeticBinOpPointerOperands(Sema &S, SourceLocation Loc, Expr *LHSExpr, Expr *RHSExpr)
Check the validity of a binary arithmetic operation w.r.t.
static bool breakDownVectorType(QualType type, uint64_t &len, QualType &eltType)
static bool isInvalid(LocType Loc, bool *Invalid)
Defines the SourceManager interface.
Defines the clang::TypeLoc interface and its subclasses.
@ Open
The standard open() call: int open(const char *path, int oflag, ...);.
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
std::string getAsString(const ASTContext &Ctx, QualType Ty) const
virtual void HandleCXXImplicitFunctionInstantiation(FunctionDecl *D)
Invoked when a function is implicitly instantiated.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
TranslationUnitDecl * getTranslationUnitDecl() const
const ConstantArrayType * getAsConstantArrayType(QualType T) const
bool areLaxCompatibleSveTypes(QualType FirstType, QualType SecondType)
Return true if the given vector types are lax-compatible SVE vector types, false otherwise.
QualType getRValueReferenceType(QualType T) const
Return the uniqued reference to the type for an rvalue reference to the specified type.
CanQualType ARCUnbridgedCastTy
unsigned getIntWidth(QualType T) const
const llvm::fltSemantics & getFloatTypeSemantics(QualType T) const
Return the APFloat 'semantics' for the specified scalar floating point type.
QualType areCommonBaseCompatible(const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT)
QualType getBlockPointerType(QualType T) const
Return the uniqued reference to the type for a block of the specified type.
bool ObjCQualifiedIdTypesAreCompatible(const ObjCObjectPointerType *LHS, const ObjCObjectPointerType *RHS, bool ForCompare)
ObjCQualifiedIdTypesAreCompatible - We know that one of lhs/rhs is an ObjCQualifiedIDType.
QualType getMemberPointerType(QualType T, const Type *Cls) const
Return the uniqued reference to the type for a member pointer to the specified type in the specified ...
QualType getBuiltinVaListType() const
Retrieve the type of the __builtin_va_list type.
DeclarationNameTable DeclarationNames
int getIntegerTypeOrder(QualType LHS, QualType RHS) const
Return the highest ranked integer type, see C99 6.3.1.8p1.
QualType getBuiltinMSVaListType() const
Retrieve the type of the __builtin_ms_va_list type.
QualType getFunctionNoProtoType(QualType ResultTy, const FunctionType::ExtInfo &Info) const
Return a K&R style C function type like 'int()'.
QualType getCorrespondingSignedFixedPointType(QualType Ty) const
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
CanQualType OMPArrayShapingTy
QualType getObjCSelRedefinitionType() const
Retrieve the type that 'SEL' has been defined to, which may be different from the built-in 'SEL' if '...
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
bool canAssignObjCInterfaces(const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT)
canAssignObjCInterfaces - Return true if the two interface types are compatible for assignment from R...
llvm::DenseSet< const VarDecl * > CUDAStaticDeviceVarReferencedByHost
Keep track of CUDA/HIP static device variables referenced by host code.
bool isObjCSelType(QualType T) const
QualType getLValueReferenceType(QualType T, bool SpelledAsLValue=true) const
Return the uniqued reference to the type for an lvalue reference to the specified type.
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
CanQualType OMPIteratorTy
Builtin::Context & BuiltinInfo
const LangOptions & getLangOpts() const
TypedefDecl * getBOOLDecl() const
Retrieve declaration of 'BOOL' typedef.
QualType mergeTypes(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false, bool BlockReturnType=false)
bool typesAreBlockPointerCompatible(QualType, QualType)
Optional< CharUnits > getTypeSizeInCharsIfKnown(QualType Ty) const
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
QualType getPointerDiffType() const
Return the unique type for "ptrdiff_t" (C99 7.17) defined in <stddef.h>.
void setBOOLDecl(TypedefDecl *TD)
Save declaration of 'BOOL' typedef.
int getFloatingTypeOrder(QualType LHS, QualType RHS) const
Compare the rank of the two specified floating point types, ignoring the domain of the type (i....
QualType getIntTypeForBitwidth(unsigned DestWidth, unsigned Signed) const
getIntTypeForBitwidth - sets integer QualTy according to specified details: bitwidth,...
CanQualType UnsignedLongTy
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location,...
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
TypeInfo getTypeInfo(const Type *T) const
Get the size and alignment of the specified complete type in bits.
QualType getStringLiteralArrayType(QualType EltTy, unsigned Length) const
Return a type for a constant array for a string literal of the specified element type and length.
bool mayExternalizeStaticVar(const Decl *D) const
Whether a C++ static variable may be externalized.
QualType getCorrespondingSaturatedType(QualType Ty) const
QualType getBOOLType() const
type of 'BOOL' type.
CanQualType BoundMemberTy
QualType removeAddrSpaceQualType(QualType T) const
Remove any existing address space on the type and returns the type with qualifiers intact (or that's ...
CanQualType PseudoObjectTy
QualType getAttributedType(attr::Kind attrKind, QualType modifiedType, QualType equivalentType)
QualType getVectorType(QualType VectorType, unsigned NumElts, VectorType::VectorKind VecKind) const
Return the unique reference to a vector type of the specified element type and size.
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
bool areComparableObjCPointerTypes(QualType LHS, QualType RHS)
QualType getConstantArrayType(QualType EltTy, const llvm::APInt &ArySize, const Expr *SizeExpr, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return the unique reference to the type for a constant array of the specified element type.
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
CanQualType ObjCBuiltinBoolTy
llvm::FixedPointSemantics getFixedPointSemantics(QualType Ty) const
static bool isObjCNSObjectType(QualType Ty)
Return true if this is an NSObject object with its NSObject attribute set.
QualType getObjCIdType() const
Represents the Objective-CC id type.
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
CanQualType UnsignedCharTy
CanQualType UnsignedIntTy
TypeSourceInfo * CreateTypeSourceInfo(QualType T, unsigned Size=0) const
Allocate an uninitialized TypeSourceInfo.
QualType getObjCClassRedefinitionType() const
Retrieve the type that Class has been defined to, which may be different from the built-in Class if C...
CanQualType UnsignedLongLongTy
QualType getArrayDecayedType(QualType T) const
Return the properly qualified result of decaying the specified array type to a pointer.
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
QualType getObjCIdRedefinitionType() const
Retrieve the type that id has been defined to, which may be different from the built-in id if id has ...
QualType getPromotedIntegerType(QualType PromotableType) const
Return the type that PromotableType will promote to: C99 6.3.1.1p2, assuming that PromotableType is a...
llvm::APFixedPoint getFixedPointMax(QualType Ty) const
QualType getComplexType(QualType T) const
Return the uniqued reference to the type for a complex number with the specified element type.
bool areCompatibleSveTypes(QualType FirstType, QualType SecondType)
Return true if the given types are an SVE builtin and a VectorType that is a fixed-length representat...
bool hasDirectOwnershipQualifier(QualType Ty) const
Return true if the type has been explicitly qualified with ObjC ownership.
QualType getExtVectorType(QualType VectorType, unsigned NumElts) const
Return the unique reference to an extended vector type of the specified element type and size.
bool areCompatibleVectorTypes(QualType FirstVec, QualType SecondVec)
Return true if the given vector types are of the same unqualified type or if they are equivalent to t...
DeclarationNameInfo getNameForTemplate(TemplateName Name, SourceLocation NameLoc) const
const TargetInfo & getTargetInfo() const
CanQualType IncompleteMatrixIdxTy
QualType getCorrespondingUnsignedType(QualType T) const
bool typesAreCompatible(QualType T1, QualType T2, bool CompareUnqualified=false)
Compatibility predicates used to check assignment expressions.
QualType getAddrSpaceQualType(QualType T, LangAS AddressSpace) const
Return the uniqued reference to the type for an address space qualified type with the specified type ...
QualType getWideCharType() const
Return the type of wide characters.
QualType getLogicalOperationType() const
The result type of logical operations, '<', '>', '!=', etc.
unsigned char getFixedPointScale(QualType Ty) const
QualType adjustStringLiteralBaseType(QualType StrLTy) const
bool hasCvrSimilarType(QualType T1, QualType T2)
Determine if two types are similar, ignoring only CVR qualifiers.
bool isDependenceAllowed() const
QualType getConstantMatrixType(QualType ElementType, unsigned NumRows, unsigned NumColumns) const
Return the unique reference to the matrix type of the specified element type and size.
QualType isPromotableBitField(Expr *E) const
Whether this is a promotable bitfield reference according to C99 6.3.1.1p2, bullet 2 (and GCC extensi...
bool isSentinelNullExpr(const Expr *E)
CanQualType OMPArraySectionTy
uint64_t getCharWidth() const
Return the size of the character type, in bits.
AddrLabelExpr - The GNU address of label extension, representing &&label.
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
SourceLocation getExprLoc() const LLVM_READONLY
Wrapper for source info for arrays.
Represents an array type, per C99 6.7.5.2 - Array Declarators.
ArraySizeModifier getSizeModifier() const
QualType getElementType() const
AsTypeExpr - Clang builtin function __builtin_astype [OpenCL 6.2.4.2] This AST node provides support ...
Attr - This represents one attribute.
static Kind getNullabilityAttrKind(NullabilityKind kind)
Retrieve the attribute kind corresponding to the given nullability kind.
Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained by a type-constraint.
One specifier in an @available expression.
StringRef getPlatform() const
VersionTuple getVersion() const
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
A builtin binary operation expression such as "x + y" or "x <= y".
static OverloadedOperatorKind getOverloadedOperator(Opcode Opc)
Retrieve the overloaded operator kind that corresponds to the given binary opcode.
static bool isComparisonOp(Opcode Opc)
bool isComparisonOp() const
StringRef getOpcodeStr() const
bool isRelationalOp() const
SourceLocation getOperatorLoc() const
bool isCompoundAssignmentOp() const
bool isMultiplicativeOp() const
static StringRef getOpcodeStr(Opcode Op)
getOpcodeStr - Turn an Opcode enum value into the punctuation char it corresponds to,...
bool isEqualityOp() const
static BinaryOperator * Create(const ASTContext &C, Expr *lhs, Expr *rhs, Opcode opc, QualType ResTy, ExprValueKind VK, ExprObjectKind OK, SourceLocation opLoc, FPOptionsOverride FPFeatures)
static bool isNullPointerArithmeticExtension(ASTContext &Ctx, Opcode Opc, Expr *LHS, Expr *RHS)
bool isAdditiveOp() const
bool isAssignmentOp() const
static Opcode getOverloadedOpcode(OverloadedOperatorKind OO)
Retrieve the binary opcode that corresponds to the given overloaded operator.
static bool isBitwiseOp(Opcode Opc)
A class which contains all the information about a particular captured value.
Represents a block literal declaration, which is like an unnamed FunctionDecl.
void setParams(ArrayRef< ParmVarDecl * > NewParamInfo)
void setSignatureAsWritten(TypeSourceInfo *Sig)
void setBlockMissingReturnType(bool val=true)
void setIsVariadic(bool value)
SourceLocation getCaretLocation() const
void setBody(CompoundStmt *B)
ArrayRef< ParmVarDecl * > parameters() const
void setCaptures(ASTContext &Context, ArrayRef< Capture > Captures, bool CapturesCXXThis)
static BlockDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L)
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
This class is used for builtin types like 'int'.
bool hasPtrArgsOrResult(unsigned ID) const
Determines whether this builtin has a result or any arguments which are pointer types.
bool hasCustomTypechecking(unsigned ID) const
Determines whether this builtin has custom typechecking.
bool isPredefinedLibFunction(unsigned ID) const
Determines whether this builtin is a predefined libc/libm function, such as "malloc",...
static CUDAKernelCallExpr * Create(const ASTContext &Ctx, Expr *Fn, CallExpr *Config, ArrayRef< Expr * > Args, QualType Ty, ExprValueKind VK, SourceLocation RP, FPOptionsOverride FPFeatures, unsigned MinNumArgs=0)
Represents a path from a specific derived class (which is not represented as part of the path) to a p...
BasePaths - Represents the set of paths from a derived class to one of its (direct or indirect) bases...
Represents a C++ constructor within a class.
Represents a C++ conversion function within a class.
bool isLambdaToBlockPointerConversion() const
Determine whether this conversion function is a conversion from a lambda closure type to a block poin...
static CXXDefaultArgExpr * Create(const ASTContext &C, SourceLocation Loc, ParmVarDecl *Param, DeclContext *UsedContext)
static CXXDependentScopeMemberExpr * Create(const ASTContext &Ctx, Expr *Base, QualType BaseType, bool IsArrow, SourceLocation OperatorLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierFoundInScope, DeclarationNameInfo MemberNameInfo, const TemplateArgumentListInfo *TemplateArgs)
Represents a C++ destructor within a class.
Represents a static or instance method of a struct/union/class.
const CXXRecordDecl * getParent() const
Return the parent of this method declaration, which is the class in which this method is defined.
CXXMethodDecl * getDevirtualizedMethod(const Expr *Base, bool IsAppleKext)
If it's possible to devirtualize a call to this method, return the called function.
A call to an overloaded operator written using operator syntax.
SourceLocation getOperatorLoc() const
Returns the location of the operator symbol in the expression.
SourceRange getSourceRange() const
Represents a C++ struct/union/class.
bool hasAnyDependentBases() const
Determine whether this class has any dependent base classes which are not the current instantiation.
CXXRecordDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
bool isDerivedFrom(const CXXRecordDecl *Base) const
Determine whether this class is derived from the class Base.
Represents a C++ nested-name-specifier or a global scope specifier.
bool isValid() const
A scope specifier is present, and it refers to a real scope.
void MakeTrivial(ASTContext &Context, NestedNameSpecifier *Qualifier, SourceRange R)
Make a new nested-name-specifier from incomplete source-location information.
SourceRange getRange() const
SourceLocation getBeginLoc() const
bool isSet() const
Deprecated.
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context.
NestedNameSpecifier * getScopeRep() const
Retrieve the representation of the nested-name-specifier.
bool isInvalid() const
An error occurred during parsing of the scope specifier.
bool isEmpty() const
No scope specifier.
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
void setArg(unsigned Arg, Expr *ArgExpr)
setArg - Set the specified argument.
static CallExpr * Create(const ASTContext &Ctx, Expr *Fn, ArrayRef< Expr * > Args, QualType Ty, ExprValueKind VK, SourceLocation RParenLoc, FPOptionsOverride FPFeatures, unsigned MinNumArgs=0, ADLCallKind UsesADL=NotADL)
Create a call expression.
FunctionDecl * getDirectCallee()
If the callee is a FunctionDecl, return it. Otherwise return null.
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this call.
Expr ** getArgs()
Retrieve the call arguments.
void setNumArgsUnsafe(unsigned NewNumArgs)
Bluntly set a new number of arguments without doing any checks whatsoever.
void shrinkNumArgs(unsigned NewNumArgs)
Reduce the number of arguments in this call expression.
CanQual< T > getUnqualifiedType() const
Retrieve the unqualified form of this type.
QualType withConst() const
Retrieves a version of this type with const applied.
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
CastKind getCastKind() const
const char * getCastKindName() const
CharLiteralParser - Perform interpretation and semantic analysis of a character literal.
unsigned getUDSuffixOffset() const
StringRef getUDSuffix() const
uint64_t getValue() const
Represents a character-granular source range.
static CharSourceRange getCharRange(SourceRange R)
static CharSourceRange getTokenRange(SourceRange R)
CharUnits - This is an opaque type for sizes expressed in character units.
bool isZero() const
isZero - Test whether the quantity equals zero.
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
unsigned getValue() const
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
Complex values, per C99 6.2.5p11.
QualType getElementType() const
static CompoundAssignOperator * Create(const ASTContext &C, Expr *lhs, Expr *rhs, Opcode opc, QualType ResTy, ExprValueKind VK, ExprObjectKind OK, SourceLocation opLoc, FPOptionsOverride FPFeatures, QualType CompLHSType=QualType(), QualType CompResultType=QualType())
CompoundLiteralExpr - [C99 6.5.2.5].
CompoundStmt - This represents a group of statements like { stmt stmt }.
Stmt * getStmtExprResult()
ConditionalOperator - The ?: ternary operator.
Represents the canonical version of C arrays with a specified constant size.
const llvm::APInt & getSize() const
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
void MoveIntoResult(APValue &Value, const ASTContext &Context)
SourceLocation getBeginLoc() const LLVM_READONLY
static ResultStorageKind getStorageKind(const APValue &Value)
static ConstantExpr * Create(const ASTContext &Context, Expr *E, const APValue &Result)
bool isImmediateInvocation() const
Represents a concrete matrix type with constant number of rows and columns.
unsigned getNumColumns() const
Returns the number of columns in the matrix.
unsigned getNumRows() const
Returns the number of rows in the matrix.
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
Base class for callback objects used by Sema::CorrectTypo to check the validity of a potential typo c...
void setTypoName(IdentifierInfo *II)
void setTypoNNS(NestedNameSpecifier *NNS)
Wrapper for source info for pointers decayed from arrays and functions.
A POD class for pairing a NamedDecl* with an access specifier.
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
DeclContext * getParent()
getParent - Returns the containing DeclContext.
bool Equals(const DeclContext *DC) const
Determine whether this declaration context is equivalent to the declaration context DC.
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
const BlockDecl * getInnermostBlockDecl() const
Return this DeclContext if it is a BlockDecl.
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
void addDecl(Decl *D)
Add the declaration D into this context.
bool containsDecl(Decl *D) const
Checks whether a declaration is in this context.
bool isFunctionOrMethod() const
DeclContext * getLookupParent()
Find the parent context of this context that will be used for unqualified name lookup.
bool Encloses(const DeclContext *DC) const
Determine whether this declaration context encloses the declaration context DC.
A reference to a declared variable, function, enum, etc.
bool refersToEnclosingVariableOrCapture() const
Does this DeclRefExpr refer to an enclosing local or a captured variable?
void setDecl(ValueDecl *NewD)
SourceLocation getBeginLoc() const LLVM_READONLY
static DeclRefExpr * Create(const ASTContext &Context, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, ValueDecl *D, bool RefersToEnclosingVariableOrCapture, SourceLocation NameLoc, QualType T, ExprValueKind VK, NamedDecl *FoundD=nullptr, const TemplateArgumentListInfo *TemplateArgs=nullptr, NonOdrUseReason NOUR=NOUR_None)
SourceLocation getLocation() const
NestedNameSpecifier * getQualifier() const
If the name was qualified, retrieves the nested-name-specifier that precedes the name.
Decl - This represents one declaration (or definition), e.g.
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
AvailabilityResult getAvailability(std::string *Message=nullptr, VersionTuple EnclosingVersion=VersionTuple(), StringRef *RealizedPlatform=nullptr) const
Determine the availability of the given declaration.
void markUsed(ASTContext &C)
Mark the declaration used, in the sense of odr-use.
bool isInvalidDecl() const
SourceLocation getLocation() const
void setReferenced(bool R=true)
bool isUsed(bool CheckUsedAttr=true) const
Whether any (re-)declaration of the entity was used, meaning that a definition is required.
bool isDefinedOutsideFunctionOrMethod() const
isDefinedOutsideFunctionOrMethod - This predicate returns true if this scoped decl is defined outside...
DeclContext * getDeclContext()
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
The name of a declaration.
IdentifierInfo * getAsIdentifierInfo() const
Retrieve the IdentifierInfo * stored in this declaration name, or null if this declaration name isn't...
std::string getAsString() const
Retrieve the human-readable string for this name.
@ CXXConversionFunctionName
void setQualifierInfo(NestedNameSpecifierLoc QualifierLoc)
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier (with source-location information) that qualifies the name of this...
TypeSourceInfo * getTypeSourceInfo() const
Information about one declarator, including the parsed type information and the identifier.
DeclaratorContext getContext() const
SourceLocation getBeginLoc() const LLVM_READONLY
IdentifierInfo * getIdentifier() const
bool isInvalidType() const
static DependentScopeDeclRefExpr * Create(const ASTContext &Context, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs)
bool isIgnored(unsigned DiagID, SourceLocation Loc) const
Determine whether the diagnostic is known to be ignored.
void setElaboratedKeywordLoc(SourceLocation Loc)
void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc)
RAII object that enters a new expression evaluation context.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums.
EnumDecl * getDecl() const
ExplicitCastExpr - An explicit cast written in the source code.
QualType getTypeAsWritten() const
getTypeAsWritten - Returns the type that this expression is casting to, as written in the source code...
This represents one expression.
bool EvaluateAsInt(EvalResult &Result, const ASTContext &Ctx, SideEffectsKind AllowSideEffects=SE_NoSideEffects, bool InConstantContext=false) const
EvaluateAsInt - Return true if this is a constant which we can fold and convert to an integer,...
Expr * IgnoreParenNoopCasts(const ASTContext &Ctx) LLVM_READONLY
Skip past any parenthese and casts which do not change the value (including ptr->int casts of the sam...
isModifiableLvalueResult isModifiableLvalue(ASTContext &Ctx, SourceLocation *Loc=nullptr) const
isModifiableLvalue - C99 6.3.2.1: an lvalue that does not have array type, does not have an incomplet...
static QualType findBoundMemberType(const Expr *expr)
Given an expression of bound-member type, find the type of the member.
llvm::APSInt EvaluateKnownConstIntCheckOverflow(const ASTContext &Ctx, SmallVectorImpl< PartialDiagnosticAt > *Diag=nullptr) const
Expr * IgnoreParenCasts() LLVM_READONLY
Skip past any parentheses and casts which might surround this expression until reaching a fixed point...
LValueClassification ClassifyLValue(ASTContext &Ctx) const
Reasons why an expression might not be an l-value.
bool isValueDependent() const
Determines whether the value of this expression depends on.
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
bool isTypeDependent() const
Determines whether the type of this expression depends on.
bool containsUnexpandedParameterPack() const
Whether this expression contains an unexpanded parameter pack (for C++11 variadic templates).
Expr * IgnoreParenImpCasts() LLVM_READONLY
Skip past any parentheses and implicit casts which might surround this expression until reaching a fi...
Expr * IgnoreImplicit() LLVM_READONLY
Skip past any implicit AST nodes which might surround this expression until reaching a fixed point.
Expr * IgnoreConversionOperatorSingleStep() LLVM_READONLY
Skip conversion operators.
bool containsErrors() const
Whether this expression contains subexpressions which had errors, e.g.
bool EvaluateAsFloat(llvm::APFloat &Result, const ASTContext &Ctx, SideEffectsKind AllowSideEffects=SE_NoSideEffects, bool InConstantContext=false) const
EvaluateAsFloat - Return true if this is a constant which we can fold and convert to a floating point...
Expr * IgnoreParens() LLVM_READONLY
Skip past any parentheses which might surround this expression until reaching a fixed point.
bool isLValue() const
isLValue - True if this expression is an "l-value" according to the rules of the current language.
static bool hasAnyTypeDependentArguments(ArrayRef< Expr * > Exprs)
hasAnyTypeDependentArguments - Determines if any of the expressions in Exprs is type-dependent.
@ NPC_ValueDependentIsNull
Specifies that a value-dependent expression of integral or dependent type should be considered a null...
@ NPC_NeverValueDependent
Specifies that the expression should never be value-dependent.
@ NPC_ValueDependentIsNotNull
Specifies that a value-dependent expression should be considered to never be a null pointer constant.
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
bool EvaluateAsRValue(EvalResult &Result, const ASTContext &Ctx, bool InConstantContext=false) const
EvaluateAsRValue - Return true if this is a constant which we can fold to an rvalue using any crazy t...
bool HasSideEffects(const ASTContext &Ctx, bool IncludePossibleEffects=true) const
HasSideEffects - This routine returns true for all those expressions which have any effect other than...
bool EvaluateAsConstantExpr(EvalResult &Result, const ASTContext &Ctx, ConstantExprKind Kind=ConstantExprKind::Normal) const
Evaluate an expression that is required to be a constant expression.
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on.
bool isIntegerConstantExpr(const ASTContext &Ctx, SourceLocation *Loc=nullptr) const
Expr * IgnoreImpCasts() LLVM_READONLY
Skip past any implicit casts which might surround this expression until reaching a fixed point.
NullPointerConstantKind
Enumeration used to describe the kind of Null pointer constant returned from isNullPointerConstant().
@ NPCK_ZeroExpression
Expression is a Null pointer constant built from a zero integer expression that is not a simple,...
@ NPCK_ZeroLiteral
Expression is a Null pointer constant built from a literal zero.
@ NPCK_CXX11_nullptr
Expression is a C++11 nullptr.
@ NPCK_NotNull
Expression is not a Null pointer constant.
bool EvaluateAsBooleanCondition(bool &Result, const ASTContext &Ctx, bool InConstantContext=false) const
EvaluateAsBooleanCondition - Return true if this is a constant which we can fold and convert to a boo...
NullPointerConstantKind isNullPointerConstant(ASTContext &Ctx, NullPointerConstantValueDependence NPC) const
isNullPointerConstant - C99 6.3.2.3p3 - Test if this reduces down to a Null pointer constant.
void setValueKind(ExprValueKind Cat)
setValueKind - Set the value kind produced by this expression.
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
Optional< llvm::APSInt > getIntegerConstantExpr(const ASTContext &Ctx, SourceLocation *Loc=nullptr, bool isEvaluated=true) const
isIntegerConstantExpr - Return the value if this expression is a valid integer constant expression.
static bool isSameComparisonOperand(const Expr *E1, const Expr *E2)
Checks that the two Expr's will refer to the same value as a comparison operand.
void setObjectKind(ExprObjectKind Cat)
setObjectKind - Set the object kind produced by this expression.
bool refersToBitField() const
Returns true if this expression is a gl-value that potentially refers to a bit-field.
@ MLV_DuplicateVectorComponents
@ MLV_InvalidMessageExpression
@ MLV_ConstQualifiedField
@ MLV_SubObjCPropertySetting
bool isOrdinaryOrBitFieldObject() const
bool hasPlaceholderType() const
Returns whether this expression has a placeholder type.
static ExprValueKind getValueKindForType(QualType T)
getValueKindForType - Given a formal return or parameter type, give its value kind.
bool isKnownToHaveBooleanValue(bool Semantic=true) const
isKnownToHaveBooleanValue - Return true if this is an integer expression that is known to return 0 or...
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
ExtVectorType - Extended vector type.
Represents difference between two FPOptions values.
Represents a member of a struct/union/class.
bool isBitField() const
Determines whether this field is a bitfield.
const RecordDecl * getParent() const
Returns the parent of this field declaration, which is the struct in which this field is defined.
Annotates a diagnostic with some code that should be inserted, removed, or replaced to fix the proble...
static FixItHint CreateReplacement(CharSourceRange RemoveRange, StringRef Code)
Create a code modification hint that replaces the given source range with the given code string.
static FixItHint CreateRemoval(CharSourceRange RemoveRange)
Create a code modification hint that removes the given source range.
static FixItHint CreateInsertion(SourceLocation InsertionLoc, StringRef Code, bool BeforePreviousInsertions=false)
Create a code modification hint that inserts the given code string at a specific location.
static FixedPointLiteral * CreateFromRawInt(const ASTContext &C, const llvm::APInt &V, QualType type, SourceLocation l, unsigned Scale)
static FloatingLiteral * Create(const ASTContext &C, const llvm::APFloat &V, bool isexact, QualType Type, SourceLocation L)
FullExpr - Represents a "full-expression" node.
const Expr * getSubExpr() const
bool ValidateCandidate(const TypoCorrection &candidate) override
Simple predicate used by the default RankCandidate to determine whether to return an edit distance of...
Represents a function declaration or definition.
void setInstantiationIsPending(bool IC)
State that the instantiation of this function is pending.
const ParmVarDecl * getParamDecl(unsigned i) const
Stmt * getBody(const FunctionDecl *&Definition) const
Retrieve the body (definition) of the function.
unsigned getMinRequiredArguments() const
Returns the minimum number of arguments needed to call this function.
static FunctionDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation NLoc, DeclarationName N, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool isInlineSpecified=false, bool hasWrittenPrototype=true, ConstexprSpecKind ConstexprKind=ConstexprSpecKind::Unspecified, Expr *TrailingRequiresClause=nullptr)
SourceRange getReturnTypeSourceRange() const
Attempt to compute an informative source range covering the function return type.
unsigned getBuiltinID(bool ConsiderWrapperFunctions=false) const
Returns a value indicating whether this function corresponds to a builtin function.
SourceLocation getPointOfInstantiation() const
Retrieve the (first) point of instantiation of a function template specialization or a member of a cl...
bool isInlined() const
Determine whether this function should be inlined, because it is either marked "inline" or "constexpr...
QualType getReturnType() const
ArrayRef< ParmVarDecl * > parameters() const
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this function is an instantiation of a member function of a class template specialization,...
bool hasPrototype() const
Whether this function has a prototype, either because one was explicitly written or because it was "i...
FunctionDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
bool isDeleted() const
Whether this function has been deleted.
TemplateSpecializationKind getTemplateSpecializationKindForInstantiation() const
Determine the kind of template specialization this function represents for the purpose of template in...
bool isConstexpr() const
Whether this is a (C++11) constexpr function or constexpr constructor.
bool isImplicitlyInstantiable() const
Determines whether this function is a function template specialization or a member of a class templat...
bool isExternC() const
Determines whether this function is a function with external, C linkage.
bool isDefaulted() const
Whether this function is defaulted.
bool isOverloadedOperator() const
Whether this function declaration represents an C++ overloaded operator, e.g., "operator+".
void setTemplateSpecializationKind(TemplateSpecializationKind TSK, SourceLocation PointOfInstantiation=SourceLocation())
Determine what kind of template instantiation this function represents.
OverloadedOperatorKind getOverloadedOperator() const
getOverloadedOperator - Which C++ overloaded operator this function represents, if any.
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template instantiation this function represents.
bool isUserProvided() const
True if this method is user-declared and was not deleted or defaulted on its first declaration.
size_t param_size() const
bool hasBody(const FunctionDecl *&Definition) const
Returns true if the function has a body.
bool isDefined(const FunctionDecl *&Definition, bool CheckForPendingFriendDefinition=false) const
Returns true if the function has a definition that does not need to be instantiated.
QualType getCallResultType() const
Determine the type of an expression that calls this function.
Represents a reference to a function parameter pack or init-capture pack that has been substituted bu...
SourceLocation getParameterPackLocation() const
Get the location of the parameter pack.
Represents a prototype with parameter type info, e.g.
ExtParameterInfo getExtParameterInfo(unsigned I) const
ExceptionSpecificationType getExceptionSpecType() const
Get the kind of exception specification on this function.
bool isParamConsumed(unsigned I) const
unsigned getNumParams() const
QualType getParamType(unsigned i) const
bool isVariadic() const
Whether this function prototype is variadic.
ExtProtoInfo getExtProtoInfo() const
ArrayRef< QualType > getParamTypes() const
param_type_range param_types() const
Declaration of a template function.
unsigned getNumParams() const
ParmVarDecl * getParam(unsigned i) const
SourceLocation getLocalRangeEnd() const
TypeLoc getReturnLoc() const
SourceLocation getLocalRangeBegin() const
A class which abstracts out some details necessary for making a call.
bool getCmseNSCall() const
ExtInfo withNoReturn(bool noReturn) const
FunctionType - C99 6.7.5.3 - Function Declarators.
ExtInfo getExtInfo() const
bool getNoReturnAttr() const
Determine whether this function type includes the GNU noreturn attribute.
QualType getReturnType() const
bool getCmseNSCallAttr() const
QualType getCallResultType(const ASTContext &Context) const
Determine the type of an expression that calls a function of this type.
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
static GenericSelectionExpr * Create(const ASTContext &Context, SourceLocation GenericLoc, Expr *ControllingExpr, ArrayRef< TypeSourceInfo * > AssocTypes, ArrayRef< Expr * > AssocExprs, SourceLocation DefaultLoc, SourceLocation RParenLoc, bool ContainsUnexpandedParameterPack, unsigned ResultIndex)
Create a non-result-dependent generic selection expression.
One of these records is kept for each identifier that is lexed.
tok::TokenKind getTokenID() const
If this is a source-language token (e.g.
bool isEditorPlaceholder() const
Return true if this identifier is an editor placeholder.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1....
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
static ImplicitCastExpr * Create(const ASTContext &Context, QualType T, CastKind Kind, Expr *Operand, const CXXCastPath *BasePath, ExprValueKind Cat, FPOptionsOverride FPO)
ImplicitConversionSequence - Represents an implicit conversion sequence, which may be a standard conv...
Represents a field injected from an anonymous union/struct into the parent scope.
Describes an C or C++ initializer list.
Describes the kind of initialization being performed, along with location information for tokens rela...
static InitializationKind CreateCopy(SourceLocation InitLoc, SourceLocation EqualLoc, bool AllowExplicitConvs=false)
Create a copy initialization.
static InitializationKind CreateDirectList(SourceLocation InitLoc)
static InitializationKind CreateCStyleCast(SourceLocation StartLoc, SourceRange TypeRange, bool InitList)
Create a direct initialization for a C-style cast.
Describes the sequence of initializations required to initialize a given object or reference with a s...
ExprResult Perform(Sema &S, const InitializedEntity &Entity, const InitializationKind &Kind, MultiExprArg Args, QualType *ResultType=nullptr)
Perform the actual initialization of the given entity based on the computed initialization sequence.
Describes an entity that is being initialized.
void setParameterCFAudited()
static InitializedEntity InitializeStmtExprResult(SourceLocation ReturnLoc, QualType Type)
static InitializedEntity InitializeTemporary(QualType Type)
Create the initialization entity for a temporary.
static InitializedEntity InitializeParameter(ASTContext &Context, const ParmVarDecl *Parm)
Create the initialization entity for a parameter.
static InitializedEntity InitializeBlock(SourceLocation BlockVarLoc, QualType Type, bool NRVO)
static InitializedEntity InitializeCompoundLiteralInit(TypeSourceInfo *TSI)
Create the entity for a compound literal initializer.
static IntegerLiteral * Create(const ASTContext &C, const llvm::APInt &V, QualType type, SourceLocation l)
Returns a new integer literal with value 'V' and type 'type'.
Represents the declaration of a label.
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
clang::ObjCRuntime ObjCRuntime
bool isSubscriptPointerArithmetic() const
bool isSignedOverflowDefined() const
@ None
Permit no implicit vector bitcasts.
@ Integer
Permit vector bitcasts between integer vectors with different numbers of elements but the same total ...
@ All
Permit vector bitcasts between all vectors with the same total bit-width.
static StringRef getSourceText(CharSourceRange Range, const SourceManager &SM, const LangOptions &LangOpts, bool *Invalid=nullptr)
Returns a string for the source that the range encompasses.
static SourceLocation AdvanceToTokenCharacter(SourceLocation TokStart, unsigned Characters, const SourceManager &SM, const LangOptions &LangOpts)
AdvanceToTokenCharacter - If the current SourceLocation specifies a location at the start of a token,...
Represents the results of name lookup.
@ NotFoundInCurrentInstantiation
No entity found met the criteria within the current instantiation,, but there were dependent base cla...
LLVM_ATTRIBUTE_REINITIALIZES void clear()
Clears out any current state.
bool isUnresolvableResult() const
DeclClass * getAsSingle() const
void addDecl(NamedDecl *D)
Add a declaration to these results with its natural access.
void setLookupName(DeclarationName Name)
Sets the name to look up.
bool empty() const
Return true if no decls were found.
void resolveKind()
Resolves the result kind of the lookup, possibly hiding decls.
bool isOverloadedResult() const
Determines if the results are overloaded.
SourceLocation getNameLoc() const
Gets the location of the identifier.
NamedDecl * getFoundDecl() const
Fetch the unique decl found by this lookup.
bool isSingleResult() const
Determines if this names a single result which is not an unresolved value using decl.
CXXRecordDecl * getNamingClass() const
Returns the 'naming class' for this lookup, i.e.
Sema::LookupNameKind getLookupKind() const
Gets the kind of lookup to perform.
void setNamingClass(CXXRecordDecl *Record)
Sets the 'naming class' for this lookup.
NamedDecl * getRepresentativeDecl() const
Fetches a representative decl. Useful for lazy diagnostics.
LookupResultKind getResultKind() const
void suppressDiagnostics()
Suppress the diagnostics that would normally fire because of this lookup.
DeclarationName getLookupName() const
Gets the name to look up.
const DeclarationNameInfo & getLookupNameInfo() const
Gets the name info to look up.
MS property subscript expression.
Keeps track of the mangled names of lambda expressions and block literals within a particular context...
virtual unsigned getManglingNumber(const CXXMethodDecl *CallOperator)=0
Retrieve the mangling number of a new lambda expression with the given call operator within this cont...
MatrixSubscriptExpr - Matrix subscript expression for the MatrixType extension.
Represents a matrix type, as defined in the Matrix Types clang extensions.
QualType getElementType() const
Returns type of the elements being stored in the matrix.
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
SourceLocation getMemberLoc() const
getMemberLoc - Return the location of the "member", in X->F, it is the location of 'F'.
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
static MemberExpr * Create(const ASTContext &C, Expr *Base, bool IsArrow, SourceLocation OperatorLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, ValueDecl *MemberDecl, DeclAccessPair FoundDecl, DeclarationNameInfo MemberNameInfo, const TemplateArgumentListInfo *TemplateArgs, QualType T, ExprValueKind VK, ExprObjectKind OK, NonOdrUseReason NOUR)
bool performsVirtualDispatch(const LangOptions &LO) const
Returns true if virtual dispatch is performed.
SourceLocation getBeginLoc() const LLVM_READONLY
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template specialization this is.
This represents a decl that may have a name.
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
Linkage getFormalLinkage() const
Get the linkage from a semantic point of view.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
bool isExternallyVisible() const
bool isCXXClassMember() const
Determine whether this declaration is a C++ class member.
A C++ nested-name-specifier augmented with source location information.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
static NestedNameSpecifier * Create(const ASTContext &Context, NestedNameSpecifier *Prefix, IdentifierInfo *II)
Builds a specifier combining a prefix and an identifier.
NumericLiteralParser - This performs strict semantic analysis of the content of a ppnumber,...
StringRef getUDSuffix() const
bool isFixedPointLiteral() const
bool isFloatingLiteral() const
unsigned getRadix() const
bool isIntegerLiteral() const
llvm::APFloat::opStatus GetFloatValue(llvm::APFloat &Result)
GetFloatValue - Convert this numeric literal to a floating value, using the specified APFloat fltSema...
bool GetIntegerValue(llvm::APInt &Val)
GetIntegerValue - Convert this numeric literal value to an APInt that matches Val's input width.
unsigned getUDSuffixOffset() const
bool GetFixedPointValue(llvm::APInt &StoreVal, unsigned Scale)
GetFixedPointValue - Convert this numeric literal value into a scaled integer that represents this va...
OpenMP 5.0 [2.1.5, Array Sections].
static QualType getBaseOriginalType(const Expr *Base)
Return original type of the base expression for array section.
static OMPArrayShapingExpr * Create(const ASTContext &Context, QualType T, Expr *Op, SourceLocation L, SourceLocation R, ArrayRef< Expr * > Dims, ArrayRef< SourceRange > BracketRanges)
static OMPIteratorExpr * Create(const ASTContext &Context, QualType T, SourceLocation IteratorKwLoc, SourceLocation L, SourceLocation R, ArrayRef< IteratorDefinition > Data, ArrayRef< OMPIteratorHelperData > Helpers)
A runtime availability query.
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
Represents an ObjC class declaration.
ObjCIvarDecl * lookupInstanceVariable(IdentifierInfo *IVarName, ObjCInterfaceDecl *&ClassDeclared)
bool hasDefinition() const
Determine whether this class has been defined.
ivar_iterator ivar_begin() const
ObjCInterfaceDecl * getSuperClass() const
Interfaces are the core concept in Objective-C for object oriented design.
ObjCIsaExpr - Represent X->isa and X.isa when X is an ObjC 'id' type.
ObjCIvarDecl - Represents an ObjC instance variable.
AccessControl getAccessControl() const
QualType getUsageType(QualType objectType) const
Retrieve the type of this instance variable when viewed as a member of a specific object type.
ObjCIvarRefExpr - A reference to an ObjC instance variable.
SourceLocation getBeginLoc() const LLVM_READONLY
SourceLocation getLocation() const
SourceLocation getOpLoc() const
SourceLocation getEndLoc() const LLVM_READONLY
const Expr * getBase() const
An expression that sends a message to the given Objective-C object or class.
const ObjCMethodDecl * getMethodDecl() const
ObjCMethodDecl - Represents an instance or class method declaration.
ImplicitParamDecl * getSelfDecl() const
bool isInstanceMethod() const
ObjCMethodFamily getMethodFamily() const
Determines the family of this method.
bool isClassMethod() const
ObjCInterfaceDecl * getClassInterface()
Represents a pointer to an Objective C object.
bool isObjCQualifiedIdType() const
True if this is equivalent to 'id.
bool isObjCIdType() const
True if this is equivalent to the 'id' type, i.e.
ObjCInterfaceDecl * getInterfaceDecl() const
If this pointer points to an Objective @interface type, gets the declaration for that interface.
const ObjCInterfaceType * getInterfaceType() const
If this pointer points to an Objective C @interface type, gets the type for that interface.
Represents a class type in Objective C.
Represents one property declaration in an Objective-C interface.
Represents an Objective-C protocol declaration.
bool allowsSizeofAlignof() const
Does this runtime allow sizeof or alignof on object types?
bool allowsPointerArithmetic() const
Does this runtime allow pointer arithmetic on objects?
static OffsetOfExpr * Create(const ASTContext &C, QualType type, SourceLocation OperatorLoc, TypeSourceInfo *tsi, ArrayRef< OffsetOfNode > comps, ArrayRef< Expr * > exprs, SourceLocation RParenLoc)
Helper class for OffsetOfExpr.
static OpaquePtr getFromOpaquePtr(void *P)
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
OverloadCandidateSet - A set of overload candidates, used in C++ overload resolution (C++ 13....
@ CSK_Normal
Normal lookup.
SmallVectorImpl< OverloadCandidate >::iterator iterator
OverloadingResult BestViableFunction(Sema &S, SourceLocation Loc, OverloadCandidateSet::iterator &Best)
Find the best viable function on this overload set, if it exists.
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr.
static FindResult find(Expr *E)
Finds the overloaded expression in the given expression E of OverloadTy.
ParenExpr - This represents a parethesized expression, e.g.
SourceLocation getBeginLoc() const LLVM_READONLY
const Expr * getSubExpr() const
Expr * getExpr(unsigned Init)
static ParenListExpr * Create(const ASTContext &Ctx, SourceLocation LParenLoc, ArrayRef< Expr * > Exprs, SourceLocation RParenLoc)
Create a paren list.
unsigned getNumExprs() const
Return the number of expressions in this paren list.
SourceLocation getLParenLoc() const
SourceLocation getRParenLoc() const
Represents a parameter to a function.
void setScopeInfo(unsigned scopeDepth, unsigned parameterIndex)
static ParmVarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg)
PointerType - C99 6.7.5.1 - Pointer Declarators.
QualType getPointeeType() const
static std::string ComputeName(IdentKind IK, const Decl *CurrentDecl)
static PredefinedExpr * Create(const ASTContext &Ctx, SourceLocation L, QualType FNTy, IdentKind IK, StringLiteral *SL)
Create a PredefinedExpr.
IdentifierInfo * getIdentifierInfo(StringRef Name) const
Return information about the specified preprocessor identifier token.
SourceManager & getSourceManager() const
bool isMacroDefined(StringRef Id)
const TargetInfo & getTargetInfo() const
char getSpellingOfSingleCharacterNumericConstant(const Token &Tok, bool *Invalid=nullptr) const
Given a Token Tok that is a numeric constant with length 1, return the character.
StringRef getSpelling(SourceLocation loc, SmallVectorImpl< char > &buffer, bool *invalid=nullptr) const
Return the 'spelling' of the token at the given location; does not go up to the spelling location or ...
bool isCodeCompletionEnabled() const
Determine if we are performing code completion.
const LangOptions & getLangOpts() const
DiagnosticsEngine & getDiagnostics() const
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Computes the source location just past the end of the token at this source location.
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
A (possibly-)qualified type.
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
bool hasQualifiers() const
Determine whether this type has any qualifiers.
bool hasNonTrivialToPrimitiveCopyCUnion() const
Check if this is or contains a C union that is non-trivial to copy, which is a union that has a membe...
QualType getNonLValueExprType(const ASTContext &Context) const
Determine the type of a (typically non-lvalue) expression with the specified result type.
bool isNonWeakInMRRWithObjCWeak(const ASTContext &Context) const
QualType withConst() const
void addConst()
Add the const type qualifier to this QualType.
bool isAtLeastAsQualifiedAs(QualType Other) const
Determine whether this type is at least as qualified as the other given type, requiring exact equalit...
bool isNull() const
Return true if this QualType doesn't point to a type yet.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
LangAS getAddressSpace() const
Return the address space of this type.
bool hasNonTrivialToPrimitiveDestructCUnion() const
Check if this is or contains a C union that is non-trivial to destruct, which is a union that has a m...
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
bool isAddressSpaceOverlapping(QualType T) const
Returns true if address space qualifiers overlap with T address space qualifiers.
bool isCXX98PODType(const ASTContext &Context) const
Return true if this is a POD type according to the rules of the C++98 standard, regardless of the cur...
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of this type.
QualType getNonReferenceType() const
If Type is a reference type (e.g., const int&), returns the type that the reference refers to ("const...
QualType getCanonicalType() const
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
QualType withCVRQualifiers(unsigned CVR) const
bool isCForbiddenLValueType() const
Determine whether expressions of the given type are forbidden from being lvalues in C.
bool isConstQualified() const
Determine whether this type is const-qualified.
bool hasAddressSpace() const
Check if this type has any address space qualifier.
DestructionKind isDestructedType() const
Returns a nonzero value if objects of this type require non-trivial work to clean up after.
QualType getSingleStepDesugaredType(const ASTContext &Context) const
Return the specified type with one level of "sugar" removed from the type.
static std::string getAsString(SplitQualType split, const PrintingPolicy &Policy)
bool isPODType(const ASTContext &Context) const
Determine whether this is a Plain Old Data (POD) type (C++ 3.9p10).
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
bool hasNonTrivialToPrimitiveDefaultInitializeCUnion() const
Check if this is or contains a C union that is non-trivial to default-initialize, which is a union th...
The collection of all-type qualifiers we support.
unsigned getCVRQualifiers() const
void removeCVRQualifiers(unsigned mask)
@ OCL_Strong
Assigning into this object requires the old value to be released and the new value to be retained.
@ OCL_Weak
Reading or writing from this object requires a barrier call.
@ OCL_Autoreleasing
Assigning into this object requires a lifetime extension.
void removeObjCLifetime()
void removeAddressSpace()
void setAddressSpace(LangAS space)
static bool isAddressSpaceSupersetOf(LangAS A, LangAS B)
Returns true if address space A is equal to or a superset of B.
ObjCLifetime getObjCLifetime() const
Qualifiers withoutObjCLifetime() const
Qualifiers withoutObjCGCAttr() const
bool compatiblyIncludes(Qualifiers other) const
Determines if these qualifiers compatibly include another set.
LangAS getAddressSpace() const
bool compatiblyIncludesObjCLifetime(Qualifiers other) const
Determines if these qualifiers compatibly include another set of qualifiers from the narrow perspecti...
Represents a struct/union/class.
field_range fields() const
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
RecordDecl * getDecl() const
static RecoveryExpr * Create(ASTContext &Ctx, QualType T, SourceLocation BeginLoc, SourceLocation EndLoc, ArrayRef< Expr * > SubExprs)
A class that does preorder or postorder depth-first traversal on the entire Clang AST and visits each...
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
decl_type * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
Base for LValueReferenceType and RValueReferenceType.
Scope - A scope is a transient data structure that is used while parsing the program.
unsigned getFlags() const
getFlags - Return the flags for this scope.
@ ContinueScope
This is a while, do, for, which can have continue statements embedded into it.
@ ControlScope
The controlling scope in a if/switch/while/for statement.
@ BreakScope
This is a while, do, switch, for, etc that can have break statements embedded into it.
@ DeclScope
This is a scope that can contain a declaration.
Smart pointer class that efficiently represents Objective-C method names.
StringRef getNameForSlot(unsigned argIndex) const
Retrieve the name at a given position in the selector.
bool isUnarySelector() const
A generic diagnostic builder for errors which may or may not be deferred.
RAII class used to indicate that we are performing provisional semantic analysis to determine the val...
Abstract base class used for diagnosing integer constant expression violations.
virtual SemaDiagnosticBuilder diagnoseNotICE(Sema &S, SourceLocation Loc)=0
virtual SemaDiagnosticBuilder diagnoseNotICEType(Sema &S, SourceLocation Loc, QualType T)
virtual SemaDiagnosticBuilder diagnoseFold(Sema &S, SourceLocation Loc)
Sema - This implements semantic analysis and AST building for C.
void DefineImplicitLambdaToFunctionPointerConversion(SourceLocation CurrentLoc, CXXConversionDecl *Conv)
Define the "body" of the conversion from a lambda object to a function pointer.
ExprResult CreateGenericSelectionExpr(SourceLocation KeyLoc, SourceLocation DefaultLoc, SourceLocation RParenLoc, Expr *ControllingExpr, ArrayRef< TypeSourceInfo * > Types, ArrayRef< Expr * > Exprs)
ExprResult PerformImplicitConversion(Expr *From, QualType ToType, AssignmentAction Action, bool AllowExplicit=false)
PerformImplicitConversion - Perform an implicit conversion of the expression From to the type ToType.
void AddTemplateOverloadCandidate(FunctionTemplateDecl *FunctionTemplate, DeclAccessPair FoundDecl, TemplateArgumentListInfo *ExplicitTemplateArgs, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversions=false, bool PartialOverloading=false, bool AllowExplicit=true, ADLCallKind IsADLCandidate=ADLCallKind::NotADL, OverloadCandidateParamOrder PO={})
Add a C++ function template specialization as a candidate in the candidate set, using template argume...
ObjCMethodDecl * LookupMethodInObjectType(Selector Sel, QualType Ty, bool IsInstance)
LookupMethodInType - Look up a method in an ObjCObjectType.
ParsedType CreateParsedType(QualType T, TypeSourceInfo *TInfo)
Package the given type and TSI into a ParsedType.
QualType getCurrentThisType()
Try to retrieve the type of the 'this' pointer.
SmallVector< CodeSynthesisContext, 16 > CodeSynthesisContexts
List of active code synthesis contexts.
Scope * getCurScope() const
Retrieve the parser's current scope.
CUDAFunctionTarget IdentifyCUDATarget(const FunctionDecl *D, bool IgnoreImplicitHDAttr=false)
Determines whether the given function is a CUDA device/host/kernel/etc.
const ValueDecl * getOpenMPDeclareMapperVarName() const
NamedDecl * getCurFunctionOrMethodDecl()
getCurFunctionOrMethodDecl - Return the Decl for the current ObjC method or C function we're in,...
void checkDeviceDecl(ValueDecl *D, SourceLocation Loc)
Check if the expression is allowed to be used in expressions for the offloading devices.
bool RequireCompleteSizedExprType(Expr *E, unsigned DiagID, const Ts &... Args)
QualType FindCompositeObjCPointerType(ExprResult &LHS, ExprResult &RHS, SourceLocation QuestionLoc)
FindCompositeObjCPointerType - Helper method to find composite type of two objective-c pointer types ...
void CheckObjCBridgeRelatedCast(QualType castType, Expr *castExpr)
ExprResult ActOnIntegerConstant(SourceLocation Loc, uint64_t Val)
void DiagnoseUnusedParameters(ArrayRef< ParmVarDecl * > Parameters)
Diagnose any unused parameters in the given sequence of ParmVarDecl pointers.
ExprResult IgnoredValueConversions(Expr *E)
IgnoredValueConversions - Given that an expression's result is syntactically ignored,...
@ LookupOrdinaryName
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....
@ LookupObjCImplicitSelfParam
Look up implicit 'self' parameter of an objective-c method.
@ LookupMemberName
Member name lookup, which finds the names of class/struct/union members.
ExprResult ActOnConstantExpression(ExprResult Res)
QualType CheckLogicalOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc)
ExprResult ActOnCompoundLiteral(SourceLocation LParenLoc, ParsedType Ty, SourceLocation RParenLoc, Expr *InitExpr)
bool CheckObjCBridgeRelatedConversions(SourceLocation Loc, QualType DestType, QualType SrcType, Expr *&SrcExpr, bool Diagnose=true)
@ NTCUC_LValueToRValueVolatile
ImplicitConversionSequence TryImplicitConversion(Expr *From, QualType ToType, bool SuppressUserConversions, AllowedExplicit AllowExplicit, bool InOverloadResolution, bool CStyle, bool AllowObjCWritebackConversion)
ExprResult BuildLiteralOperatorCall(LookupResult &R, DeclarationNameInfo &SuffixInfo, ArrayRef< Expr * > Args, SourceLocation LitEndLoc, TemplateArgumentListInfo *ExplicitTemplateArgs=nullptr)
BuildLiteralOperatorCall - Build a UserDefinedLiteral by creating a call to a literal operator descri...
ExprResult ImpCastExprToType(Expr *E, QualType Type, CastKind CK, ExprValueKind VK=VK_RValue, const CXXCastPath *BasePath=nullptr, CheckedConversionKind CCK=CCK_ImplicitConversion)
ImpCastExprToType - If Expr is not of type 'Type', insert an implicit cast.
bool isConstantEvaluated()
bool isSelfExpr(Expr *RExpr)
Private Helper predicate to check for 'self'.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
ExprResult BuildIvarRefExpr(Scope *S, SourceLocation Loc, ObjCIvarDecl *IV)
void DiagnoseAlwaysNonNullPointer(Expr *E, Expr::NullPointerConstantKind NullType, bool IsEqual, SourceRange Range)
Diagnose pointers that are always non-null.
ExprResult BuildCXXDefaultArgExpr(SourceLocation CallLoc, FunctionDecl *FD, ParmVarDecl *Param)
BuildCXXDefaultArgExpr - Creates a CXXDefaultArgExpr, instantiating the default expr if needed.
void DefineImplicitMoveAssignment(SourceLocation CurrentLocation, CXXMethodDecl *MethodDecl)
Defines an implicitly-declared move assignment operator.
void DecomposeUnqualifiedId(const UnqualifiedId &Id, TemplateArgumentListInfo &Buffer, DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *&TemplateArgs)
Decomposes the given name into a DeclarationNameInfo, its location, and possibly a list of template a...
bool InstantiateDefaultArgument(SourceLocation CallLoc, FunctionDecl *FD, ParmVarDecl *Param)
ExprResult BuildSourceLocExpr(SourceLocExpr::IdentKind Kind, SourceLocation BuiltinLoc, SourceLocation RPLoc, DeclContext *ParentContext)
void ActOnStartStmtExpr()
void WarnOnPendingNoDerefs(ExpressionEvaluationContextRecord &Rec)
Emit a warning for all pending noderef expressions that we recorded.
void ActOnStmtExprError()
DeclResult LookupIvarInObjCMethod(LookupResult &Lookup, Scope *S, IdentifierInfo *II)
The parser has read a name in, and Sema has detected that we're currently inside an ObjC method.
QualType UsualArithmeticConversions(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, ArithConvKind ACK)
UsualArithmeticConversions - Performs various conversions that are common to binary operators (C99 6....
void CheckPtrComparisonWithNullChar(ExprResult &E, ExprResult &NullE)
NamedDecl * ImplicitlyDefineFunction(SourceLocation Loc, IdentifierInfo &II, Scope *S)
ImplicitlyDefineFunction - An undeclared identifier was used in a function call, forming a call to an...
std::unique_ptr< NSAPI > NSAPIObj
Caches identifiers/selectors for NSFoundation APIs.
void PushExpressionEvaluationContext(ExpressionEvaluationContext NewContext, Decl *LambdaContextDecl=nullptr, ExpressionEvaluationContextRecord::ExpressionKind Type=ExpressionEvaluationContextRecord::EK_Other)
ObjCMethodDecl * LookupInstanceMethodInGlobalPool(Selector Sel, SourceRange R, bool receiverIdOrClass=false)
LookupInstanceMethodInGlobalPool - Returns the method and warns if there are multiple signatures.
ExprResult CheckBooleanCondition(SourceLocation Loc, Expr *E, bool IsConstexpr=false)
CheckBooleanCondition - Diagnose problems involving the use of the given expression as a boolean cond...
bool isOpenMPDeclareMapperVarDeclAllowed(const VarDecl *VD) const
@ Boolean
A boolean condition, from 'if', 'while', 'for', or 'do'.
@ Switch
An integral condition for a 'switch' statement.
@ ConstexprIf
A constant boolean condition from 'if constexpr'.
bool RequireCompleteDeclContext(CXXScopeSpec &SS, DeclContext *DC)
Require that the context specified by SS be complete.
llvm::SmallPtrSet< const Decl *, 4 > ParsingInitForAutoVars
ParsingInitForAutoVars - a set of declarations with auto types for which we are currently parsing the...
ExprResult ActOnIdExpression(Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, UnqualifiedId &Id, bool HasTrailingLParen, bool IsAddressOfOperand, CorrectionCandidateCallback *CCC=nullptr, bool IsInlineAsmIdentifier=false, Token *KeywordReplacement=nullptr)
SmallVector< sema::FunctionScopeInfo *, 4 > FunctionScopes
Stack containing information about each of the nested function, block, and method scopes that are cur...
bool CheckObjCARCUnavailableWeakConversion(QualType castType, QualType ExprType)
PoppedFunctionScopePtr PopFunctionScopeInfo(const sema::AnalysisBasedWarnings::Policy *WP=nullptr, const Decl *D=nullptr, QualType BlockType=QualType())
Pop a function (or block or lambda or captured region) scope from the stack.
Preprocessor & getPreprocessor() const
Scope * getScopeForContext(DeclContext *Ctx)
Determines the active Scope associated with the given declaration context.
bool CheckCXXThisCapture(SourceLocation Loc, bool Explicit=false, bool BuildAndDiagnose=true, const unsigned *const FunctionScopeIndexToStopAt=nullptr, bool ByCopy=false)
Make sure the value of 'this' is actually available in the current context, if it is a potentially ev...
ExprResult ActOnCharacterConstant(const Token &Tok, Scope *UDLScope=nullptr)
DefaultedComparisonKind getDefaultedComparisonKind(const FunctionDecl *FD)
ExprResult MaybeBindToTemporary(Expr *E)
MaybeBindToTemporary - If the passed in expression has a record type with a non-trivial destructor,...
void CheckCompleteDestructorVariant(SourceLocation CurrentLocation, CXXDestructorDecl *Dtor)
Do semantic checks to allow the complete destructor variant to be emitted when the destructor is defi...
bool CheckForConstantInitializer(Expr *e, QualType t)
type checking declaration initializers (C99 6.7.8)
ExprResult VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result, VerifyICEDiagnoser &Diagnoser, AllowFoldKind CanFold=NoFold)
VerifyIntegerConstantExpression - Verifies that an expression is an ICE, and reports the appropriate ...
bool LookupName(LookupResult &R, Scope *S, bool AllowBuiltinCreation=false)
Perform unqualified name lookup starting from a given scope.
LiteralOperatorLookupResult LookupLiteralOperator(Scope *S, LookupResult &R, ArrayRef< QualType > ArgTys, bool AllowRaw, bool AllowTemplate, bool AllowStringTemplate, bool DiagnoseMissing, StringLiteral *StringLit=nullptr)
LookupLiteralOperator - Determine which literal operator should be used for a user-defined literal,...
FPOptionsOverride CurFPFeatureOverrides()
bool isValidSveBitcast(QualType srcType, QualType destType)
Are the two types SVE-bitcast-compatible types? I.e.
void ProcessDeclAttributes(Scope *S, Decl *D, const Declarator &PD)
ExprResult ActOnDependentIdExpression(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, bool isAddressOfOperand, const TemplateArgumentListInfo *TemplateArgs)
ActOnDependentIdExpression - Handle a dependent id-expression that was just parsed.
ObjCLiteralKind CheckLiteralKind(Expr *FromE)
QualType getCapturedDeclRefType(VarDecl *Var, SourceLocation Loc)
Given a variable, determine the type that a reference to that variable will have in the given scope.
ObjCMethodDecl * LookupMethodInQualifiedType(Selector Sel, const ObjCObjectPointerType *OPT, bool IsInstance)
LookupMethodInQualifiedType - Lookups up a method in protocol qualifier list of a qualified objective...
ExprResult BuildStmtExpr(SourceLocation LPLoc, Stmt *SubStmt, SourceLocation RPLoc, unsigned TemplateDepth)
ExprResult ActOnOMPArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLocFirst, SourceLocation ColonLocSecond, Expr *Length, Expr *Stride, SourceLocation RBLoc)
ExprResult BuildVAArgExpr(SourceLocation BuiltinLoc, Expr *E, TypeSourceInfo *TInfo, SourceLocation RPLoc)
ExprResult PerformContextualImplicitConversion(SourceLocation Loc, Expr *FromE, ContextualImplicitConverter &Converter)
Perform a contextual implicit conversion.
ExprResult UsualUnaryConversions(Expr *E)
UsualUnaryConversions - Performs various conversions that are common to most operators (C99 6....
ExprResult CheckUnevaluatedOperand(Expr *E)
ExprResult DefaultVariadicArgumentPromotion(Expr *E, VariadicCallType CT, FunctionDecl *FDecl)
DefaultVariadicArgumentPromotion - Like DefaultArgumentPromotion, but will create a trap if the resul...
void DiagnoseCommaOperator(const Expr *LHS, SourceLocation Loc)
ExprResult tryConvertExprToType(Expr *E, QualType Ty)
Try to convert an expression E to type Ty.
bool DeduceReturnType(FunctionDecl *FD, SourceLocation Loc, bool Diagnose=true)
QualType CheckAddressOfOperand(ExprResult &Operand, SourceLocation OpLoc)
CheckAddressOfOperand - The operand of & must be either a function designator or an lvalue designatin...
ParmVarDecl * BuildParmVarDeclForTypedef(DeclContext *DC, SourceLocation Loc, QualType T)
Synthesizes a variable for a parameter arising from a typedef.
ExprResult CheckSwitchCondition(SourceLocation SwitchLoc, Expr *Cond)
static bool TooManyArguments(size_t NumParams, size_t NumArgs, bool PartialOverloading=false)
To be used for checking whether the arguments being passed to function exceeds the number of paramete...
QualType InvalidOperands(SourceLocation Loc, ExprResult &LHS, ExprResult &RHS)
the following "Check" methods will return a valid/converted QualType or a null QualType (indicating a...
QualType CheckShiftOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc, bool IsCompAssign=false)
ExprResult BuildQualifiedDeclarationNameExpr(CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, bool IsAddressOfOperand, const Scope *S, TypeSourceInfo **RecoveryTSI=nullptr)
BuildQualifiedDeclarationNameExpr - Build a C++ qualified declaration name, generally during template...
DiagnosticsEngine & getDiagnostics() const
ExprResult MaybeConvertParenListExprToParenExpr(Scope *S, Expr *ME)
This is not an AltiVec-style cast or or C++ direct-initialization, so turn the ParenListExpr into a s...
bool checkAddressOfFunctionIsAvailable(const FunctionDecl *Function, bool Complain=false, SourceLocation Loc=SourceLocation())
Returns whether the given function's address can be taken or not, optionally emitting a diagnostic if...
ExprResult checkPseudoObjectAssignment(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opcode, Expr *LHS, Expr *RHS)
bool CheckCaseExpression(Expr *E)
bool LookupBuiltin(LookupResult &R)
Lookup a builtin function, when name lookup would otherwise fail.
QualType CheckMatrixElementwiseOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign)
Type checking for matrix binary operators.
bool tryToRecoverWithCall(ExprResult &E, const PartialDiagnostic &PD, bool ForceComplain=false, bool(*IsPlausibleResult)(QualType)=nullptr)
Try to recover by turning the given expression into a call.
FunctionDecl * ResolveAddressOfOverloadedFunction(Expr *AddressOfExpr, QualType TargetType, bool Complain, DeclAccessPair &Found, bool *pHadMultipleCandidates=nullptr)
ResolveAddressOfOverloadedFunction - Try to resolve the address of an overloaded function (C++ [over....
void PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext=true)
Add this decl to the scope shadowed decl chains.
ExprResult ActOnSourceLocExpr(SourceLocExpr::IdentKind Kind, SourceLocation BuiltinLoc, SourceLocation RPLoc)
void LookupOverloadedOperatorName(OverloadedOperatorKind Op, Scope *S, UnresolvedSetImpl &Functions)
void CleanupVarDeclMarking()
ExprResult DefaultFunctionArrayLvalueConversion(Expr *E, bool Diagnose=true)
ASTContext & getASTContext() const
std::unique_ptr< sema::FunctionScopeInfo, PoppedFunctionScopeDeleter > PoppedFunctionScopePtr
ExprResult CallExprUnaryConversions(Expr *E)
CallExprUnaryConversions - a special case of an unary conversion performed on a function designator o...
void translateTemplateArguments(const ASTTemplateArgsPtr &In, TemplateArgumentListInfo &Out)
Translates template arguments as provided by the parser into template arguments used by semantic anal...
NamedDecl * LookupSingleName(Scope *S, DeclarationName Name, SourceLocation Loc, LookupNameKind NameKind, RedeclarationKind Redecl=NotForRedeclaration)
Look up a name, looking for a single declaration.
void MarkVariableReferenced(SourceLocation Loc, VarDecl *Var)
Mark a variable referenced, and check whether it is odr-used (C++ [basic.def.odr]p2,...
llvm::SetVector< Expr *, SmallVector< Expr *, 4 >, llvm::SmallPtrSet< Expr *, 4 > > MaybeODRUseExprSet
Store a set of either DeclRefExprs or MemberExprs that contain a reference to a variable (constant) t...
void LookupBinOp(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opc, UnresolvedSetImpl &Functions)
ExprResult BuildTemplateIdExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, bool RequiresADL, const TemplateArgumentListInfo *TemplateArgs)
void MarkDeclarationsReferencedInExpr(Expr *E, bool SkipLocalVariables=false)
Mark any declarations that appear within this expression or any potentially-evaluated subexpressions ...
void DiagnoseUnguardedAvailabilityViolations(Decl *FD)
Issue any -Wunguarded-availability warnings in FD.
void PopExpressionEvaluationContext()
AssignConvertType CheckTransparentUnionArgumentConstraints(QualType ArgType, ExprResult &RHS)
ExprResult CreateOverloadedBinOp(SourceLocation OpLoc, BinaryOperatorKind Opc, const UnresolvedSetImpl &Fns, Expr *LHS, Expr *RHS, bool RequiresADL=true, bool AllowRewrittenCandidates=true, FunctionDecl *DefaultedFn=nullptr)
Create a binary operation that may resolve to an overloaded operator.
ExprResult DefaultArgumentPromotion(Expr *E)
DefaultArgumentPromotion (C99 6.5.2.2p6).
bool UseArgumentDependentLookup(const CXXScopeSpec &SS, const LookupResult &R, bool HasTrailingLParen)
void InstantiateVariableDefinition(SourceLocation PointOfInstantiation, VarDecl *Var, bool Recursive=false, bool DefinitionRequired=false, bool AtEndOfTU=false)
Instantiate the definition of the given variable from its template.
ExprResult BuildCallToMemberFunction(Scope *S, Expr *MemExpr, SourceLocation LParenLoc, MultiExprArg Args, SourceLocation RParenLoc, bool AllowRecovery=false)
BuildCallToMemberFunction - Build a call to a member function.
ExprResult BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo, SourceLocation RParenLoc, Expr *LiteralExpr)
ExprResult ActOnAddrLabel(SourceLocation OpLoc, SourceLocation LabLoc, LabelDecl *TheDecl)
ActOnAddrLabel - Parse the GNU address of label extension: "&&foo".
DefaultedComparisonKind
Kinds of defaulted comparison operator functions.
@ None
This is not a defaultable comparison operator.
ExprResult ActOnParenListExpr(SourceLocation L, SourceLocation R, MultiExprArg Val)
bool checkSYCLDeviceFunction(SourceLocation Loc, FunctionDecl *Callee)
Check whether we're allowed to call Callee from the current context.
QualType CheckMatrixMultiplyOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign)
bool isOpenMPGlobalCapturedDecl(ValueDecl *D, unsigned Level, unsigned CaptureLevel) const
Check if the specified global variable must be captured by outer capture regions.
ObjCMethodDecl * getCurMethodDecl()
getCurMethodDecl - If inside of a method body, this returns a pointer to the method decl for the meth...
DeclRefExpr * BuildDeclRefExpr(ValueDecl *D, QualType Ty, ExprValueKind VK, SourceLocation Loc, const CXXScopeSpec *SS=nullptr)
DeclContext * getFunctionLevelDeclContext()
void DefineImplicitMoveConstructor(SourceLocation CurrentLocation, CXXConstructorDecl *Constructor)
DefineImplicitMoveConstructor - Checks for feasibility of defining this constructor as the move const...
ExprResult ActOnChooseExpr(SourceLocation BuiltinLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr, SourceLocation RPLoc)
void checkUnusedDeclAttributes(Declarator &D)
CastKind PrepareCastToObjCObjectPointer(ExprResult &E)
Prepare a conversion of the given expression to an ObjC object pointer type.
void DiagnoseSelfMove(const Expr *LHSExpr, const Expr *RHSExpr, SourceLocation OpLoc)
Warn if a value is moved to itself.
void checkDeclIsAllowedInOpenMPTarget(Expr *E, Decl *D, SourceLocation IdLoc=SourceLocation())
Check declaration inside target region.
ExprResult PerformOpenMPImplicitIntegerConversion(SourceLocation OpLoc, Expr *Op)
SourceRange getExprRange(Expr *E) const
void tryCaptureOpenMPLambdas(ValueDecl *V)
Function tries to capture lambda's captured variables in the OpenMP region before the original lambda...
void DefineImplicitCopyConstructor(SourceLocation CurrentLocation, CXXConstructorDecl *Constructor)
DefineImplicitCopyConstructor - Checks for feasibility of defining this constructor as the copy const...
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
void CheckTollFreeBridgeCast(QualType castType, Expr *castExpr)
@ UPPC_Block
Block expression.
void DiagnoseSentinelCalls(NamedDecl *D, SourceLocation Loc, ArrayRef< Expr * > Args)
DiagnoseSentinelCalls - This routine checks whether a call or message-send is to a declaration with t...
const LangOptions & getLangOpts() const
TypoCorrection CorrectTypo(const DeclarationNameInfo &Typo, Sema::LookupNameKind LookupKind, Scope *S, CXXScopeSpec *SS, CorrectionCandidateCallback &CCC, CorrectTypoKind Mode, DeclContext *MemberContext=nullptr, bool EnteringContext=false, const ObjCObjectPointerType *OPT=nullptr, bool RecordFailure=true)
Try to "correct" a typo in the source code by finding visible declarations whose names are similar to...
QualType CheckComparisonCategoryType(ComparisonCategoryType Kind, SourceLocation Loc, ComparisonCategoryUsage Usage)
Lookup the specified comparison category types in the standard library, an check the VarDecls possibl...
void DiagnoseInvalidJumps(Stmt *Body)
TypoExpr * CorrectTypoDelayed(const DeclarationNameInfo &Typo, Sema::LookupNameKind LookupKind, Scope *S, CXXScopeSpec *SS, CorrectionCandidateCallback &CCC, TypoDiagnosticGenerator TDG, TypoRecoveryCallback TRC, CorrectTypoKind Mode, DeclContext *MemberContext=nullptr, bool EnteringContext=false, const ObjCObjectPointerType *OPT=nullptr)
Try to "correct" a typo in the source code by finding visible declarations whose names are similar to...
QualType CheckCompareOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc)
CastKind PrepareScalarCast(ExprResult &src, QualType destType)
Prepares for a scalar cast, performing all the necessary stages except the final cast and returning t...
QualType CheckVectorLogicalOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc)
const FunctionProtoType * ResolveExceptionSpec(SourceLocation Loc, const FunctionProtoType *FPT)
Optional< sema::TemplateDeductionInfo * > isSFINAEContext() const
Determines whether we are currently in a context where template argument substitution failures are no...
void AddOverloadCandidate(FunctionDecl *Function, DeclAccessPair FoundDecl, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversions=false, bool PartialOverloading=false, bool AllowExplicit=true, bool AllowExplicitConversion=false, ADLCallKind IsADLCandidate=ADLCallKind::NotADL, ConversionSequenceList EarlyConversions=None, OverloadCandidateParamOrder PO={})
AddOverloadCandidate - Adds the given function to the set of candidate functions, using the given fun...
NonOdrUseReason getNonOdrUseReasonInCurrentContext(ValueDecl *D)
If D cannot be odr-used in the current expression evaluation context, return a reason explaining why.
void DefineDefaultedComparison(SourceLocation Loc, FunctionDecl *FD, DefaultedComparisonKind DCK)
void diagnoseUnavailableAlignedAllocation(const FunctionDecl &FD, SourceLocation Loc)
Produce diagnostics if FD is an aligned allocation or deallocation function that is unavailable.
bool CheckCUDACall(SourceLocation Loc, FunctionDecl *Callee)
Check whether we're allowed to call Callee from the current context.
void MarkFunctionParmPackReferenced(FunctionParmPackExpr *E)
Perform reference-marking and odr-use handling for a FunctionParmPackExpr.
QualType CheckAdditionOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc, QualType *CompLHSTy=nullptr)
VariadicCallType getVariadicCallType(FunctionDecl *FDecl, const FunctionProtoType *Proto, Expr *Fn)
ExprResult BuildCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig=nullptr, bool IsExecConfig=false, bool AllowRecovery=false)
BuildCallExpr - Handle a call to Fn with the specified array of arguments.
bool DiagnoseUnexpandedParameterPack(SourceLocation Loc, TypeSourceInfo *T, UnexpandedParameterPackContext UPPC)
If the given type contains an unexpanded parameter pack, diagnose the error.
bool RequireNonAbstractType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
ExprResult checkPseudoObjectIncDec(Scope *S, SourceLocation OpLoc, UnaryOperatorKind Opcode, Expr *Op)
Check an increment or decrement of a pseudo-object expression.
bool CheckFunctionConstraints(const FunctionDecl *FD, ConstraintSatisfaction &Satisfaction, SourceLocation UsageLoc=SourceLocation())
Check whether the given function decl's trailing requires clause is satisfied, if any.
void CheckExtraCXXDefaultArguments(Declarator &D)
CheckExtraCXXDefaultArguments - Check for any extra default arguments in the declarator,...
bool hasCStrMethod(const Expr *E)
Check to see if a given expression could have '.c_str()' called on it.
const LangOptions & LangOpts
void EmitRelatedResultTypeNoteForReturn(QualType destType)
Given that we had incompatible pointer types in a return statement, check whether we're in a method w...
ExprResult ActOnGenericSelectionExpr(SourceLocation KeyLoc, SourceLocation DefaultLoc, SourceLocation RParenLoc, Expr *ControllingExpr, ArrayRef< ParsedType > ArgTypes, ArrayRef< Expr * > ArgExprs)
ExprResult BuildBuiltinOffsetOf(SourceLocation BuiltinLoc, TypeSourceInfo *TInfo, ArrayRef< OffsetOfComponent > Components, SourceLocation RParenLoc)
__builtin_offsetof(type, a.b[123][456].c)
sema::LambdaScopeInfo * getCurLambda(bool IgnoreNonLambdaCapturingScope=false)
Retrieve the current lambda scope info, if any.
ExprResult BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl, SourceLocation LParenLoc, ArrayRef< Expr * > Arg, SourceLocation RParenLoc, Expr *Config=nullptr, bool IsExecConfig=false, ADLCallKind UsesADL=ADLCallKind::NotADL)
BuildResolvedCallExpr - Build a call to a resolved expression, i.e.
ExprResult CheckForImmediateInvocation(ExprResult E, FunctionDecl *Decl)
Wrap the expression in a ConstantExpr if it is a potential immediate invocation.
ExprResult TemporaryMaterializationConversion(Expr *E)
If E is a prvalue denoting an unmaterialized temporary, materialize it as an xvalue.
NamedDeclSetType UnusedPrivateFields
Set containing all declared private fields that are not used.
Expr * stripARCUnbridgedCast(Expr *e)
stripARCUnbridgedCast - Given an expression of ARCUnbridgedCast type, remove the placeholder cast.
void DefineInheritingConstructor(SourceLocation UseLoc, CXXConstructorDecl *Constructor)
Define the specified inheriting constructor.
void CheckUnusedVolatileAssignment(Expr *E)
Check whether E, which is either a discarded-value expression or an unevaluated operand,...
void MaybeSuggestAddingStaticToDecl(const FunctionDecl *D)
@ OperatorInExpression
The '<=>' operator was used in an expression and a builtin operator was selected.
bool CanUseDecl(NamedDecl *D, bool TreatUnavailableAsInvalid)
Determine whether the use of this declaration is valid, without emitting diagnostics.
void MarkAnyDeclReferenced(SourceLocation Loc, Decl *D, bool MightBeOdrUse)
Perform marking for a reference to an arbitrary declaration.
void MarkVTableUsed(SourceLocation Loc, CXXRecordDecl *Class, bool DefinitionRequired=false)
Note that the vtable for the given class was used at the given location.
QualType InvalidLogicalVectorOperands(SourceLocation Loc, ExprResult &LHS, ExprResult &RHS)
bool diagnoseArgIndependentDiagnoseIfAttrs(const NamedDecl *ND, SourceLocation Loc)
Emit diagnostics for the diagnose_if attributes on Function, ignoring any ArgDependent DiagnoseIfAttr...
llvm::DenseMap< ParmVarDecl *, SourceLocation > UnparsedDefaultArgLocs
QualType getElaboratedType(ElaboratedTypeKeyword Keyword, const CXXScopeSpec &SS, QualType T, TagDecl *OwnedTagDecl=nullptr)
Retrieve a version of the type 'T' that is elaborated by Keyword, qualified by the nested-name-specif...
QualType FindCompositePointerType(SourceLocation Loc, Expr *&E1, Expr *&E2, bool ConvertArgs=true)
Find a merged pointer type and convert the two expressions to it.
VarArgKind isValidVarArgType(const QualType &Ty)
Determine the degree of POD-ness for an expression.
bool isQualifiedMemberAccess(Expr *E)
Determine whether the given expression is a qualified member access expression, of a form that could ...
bool isInOpenMPDeclareTargetContext() const
Return true inside OpenMP declare target region.
bool LookupParsedName(LookupResult &R, Scope *S, CXXScopeSpec *SS, bool AllowBuiltinCreation=false, bool EnteringContext=false)
Performs name lookup for a name that was parsed in the source code, and may contain a C++ scope speci...
static CastKind ScalarTypeToBooleanCastKind(QualType ScalarTy)
ScalarTypeToBooleanCastKind - Returns the cast kind corresponding to the conversion from scalar type ...
void DefineImplicitLambdaToBlockPointerConversion(SourceLocation CurrentLoc, CXXConversionDecl *Conv)
Define the "body" of the conversion from a lambda object to a block pointer.
void DefineImplicitDestructor(SourceLocation CurrentLocation, CXXDestructorDecl *Destructor)
DefineImplicitDestructor - Checks for feasibility of defining this destructor as the default destruct...
ExprResult BuildCStyleCastExpr(SourceLocation LParenLoc, TypeSourceInfo *Ty, SourceLocation RParenLoc, Expr *Op)
sema::FunctionScopeInfo * getCurFunction() const
ExprResult ActOnUnaryOp(Scope *S, SourceLocation OpLoc, tok::TokenKind Op, Expr *Input)
void checkUnsafeExprAssigns(SourceLocation Loc, Expr *LHS, Expr *RHS)
checkUnsafeExprAssigns - Check whether +1 expr is being assigned to weak/__unsafe_unretained expressi...
ExprResult LookupInObjCMethod(LookupResult &LookUp, Scope *S, IdentifierInfo *II, bool AllowBuiltinCreation=false)
The parser has read a name in, and Sema has detected that we're currently inside an ObjC method.
ExprResult ActOnOpenMPCall(ExprResult Call, Scope *Scope, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig)
Given the potential call expression Call, determine if there is a specialization via the OpenMP decla...
bool DiagnoseUseOfDecl(NamedDecl *D, ArrayRef< SourceLocation > Locs, const ObjCInterfaceDecl *UnknownObjCClass=nullptr, bool ObjCPropertyAccess=false, bool AvoidPartialAvailabilityChecks=false, ObjCInterfaceDecl *ClassReciever=nullptr)
Determine whether the use of this declaration is valid, and emit any corresponding diagnostics.
bool NeedToCaptureVariable(VarDecl *Var, SourceLocation Loc)
Checks if the variable must be captured.
AssignConvertType CheckSingleAssignmentConstraints(QualType LHSType, ExprResult &RHS, bool Diagnose=true, bool DiagnoseCFAudited=false, bool ConvertRHS=true)
Check assignment constraints for an assignment of RHS to LHSType.
void DiagnoseAssignmentEnum(QualType DstType, QualType SrcType, Expr *SrcExpr)
DiagnoseAssignmentEnum - Warn if assignment to enum is a constant integer not in the range of enum va...
ExprResult CreateOverloadedUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc, const UnresolvedSetImpl &Fns, Expr *input, bool RequiresADL=true)
Create a unary operation that may resolve to an overloaded operator.
void MarkCaptureUsedInEnclosingContext(VarDecl *Capture, SourceLocation Loc, unsigned CapturingScopeIndex)
bool findMacroSpelling(SourceLocation &loc, StringRef name)
Looks through the macro-expansion chain for the given location, looking for a macro expansion with th...
void DefineImplicitDefaultConstructor(SourceLocation CurrentLocation, CXXConstructorDecl *Constructor)
DefineImplicitDefaultConstructor - Checks for feasibility of defining this constructor as the default...
QualType CheckVectorOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign, bool AllowBothBool, bool AllowBoolConversion)
type checking for vector binary operators.
void AddOverloadedCallCandidates(UnresolvedLookupExpr *ULE, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool PartialOverloading=false)
Add the overload candidates named by callee and/or found by argument dependent lookup to the given ov...
ExprResult DefaultLvalueConversion(Expr *E)
ExprResult BuildDeclarationNameExpr(const CXXScopeSpec &SS, LookupResult &R, bool NeedsADL, bool AcceptInvalidDecl=false)
ExprResult BuildObjCStringLiteral(SourceLocation AtLoc, StringLiteral *S)
bool CheckDerivedToBaseConversion(QualType Derived, QualType Base, SourceLocation Loc, SourceRange Range, CXXCastPath *BasePath=nullptr, bool IgnoreAccess=false)
void maybeExtendBlockObject(ExprResult &E)
Do an explicit extend of the given block pointer if we're in ARC.
void ActOnBlockError(SourceLocation CaretLoc, Scope *CurScope)
ActOnBlockError - If there is an error parsing a block, this callback is invoked to pop the informati...
ExprResult prepareVectorSplat(QualType VectorTy, Expr *SplattedExpr)
Prepare SplattedExpr for a vector splat operation, adding implicit casts if necessary.
sema::BlockScopeInfo * getCurBlock()
Retrieve the current block, if any.
bool IvarBacksCurrentMethodAccessor(ObjCInterfaceDecl *IFace, ObjCMethodDecl *Method, ObjCIvarDecl *IV)
IvarBacksCurrentMethodAccessor - This routine returns 'true' if 'IV' is an ivar synthesized for 'Meth...
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
@ ForVisibleRedeclaration
The lookup results will be used for redeclaration of a name, if an entity by that name already exists...
MaterializeTemporaryExpr * CreateMaterializeTemporaryExpr(QualType T, Expr *Temporary, bool BoundToLvalueReference)
ExprResult checkUnknownAnyCast(SourceRange TypeRange, QualType CastType, Expr *CastExpr, CastKind &CastKind, ExprValueKind &VK, CXXCastPath &Path)
Check a cast of an unknown-any type.
SuppressedDiagnosticsMap SuppressedDiagnostics
DeclarationNameInfo GetNameFromUnqualifiedId(const UnqualifiedId &Name)
Retrieves the declaration name from a parsed unqualified-id.
std::deque< PendingImplicitInstantiation > PendingLocalImplicitInstantiations
The queue of implicit template instantiations that are required and must be performed within the curr...
ExprResult ActOnGNUNullExpr(SourceLocation TokenLoc)
bool tryCaptureVariable(VarDecl *Var, SourceLocation Loc, TryCaptureKind Kind, SourceLocation EllipsisLoc, bool BuildAndDiagnose, QualType &CaptureType, QualType &DeclRefType, const unsigned *const FunctionScopeIndexToStopAt)
Try to capture the given variable.
ExprResult PerformContextuallyConvertToBool(Expr *From)
PerformContextuallyConvertToBool - Perform a contextual conversion of the expression From to bool (C+...
void DefineImplicitCopyAssignment(SourceLocation CurrentLocation, CXXMethodDecl *MethodDecl)
Defines an implicitly-declared copy assignment operator.
bool DiagnoseDependentMemberLookup(LookupResult &R)
Diagnose a lookup that found results in an enclosing class during error recovery.
void MarkDeclarationsReferencedInType(SourceLocation Loc, QualType T)
Mark all of the declarations referenced within a particular AST node as referenced.
bool isUnevaluatedContext() const
Determines whether we are currently in a context that is not evaluated as per C++ [expr] p5.
AssignConvertType
AssignConvertType - All of the 'assignment' semantic checks return this enum to indicate whether the ...
@ IncompatiblePointerDiscardsQualifiers
IncompatiblePointerDiscardsQualifiers - The assignment discards qualifiers that we don't permit to be...
@ IntToPointer
IntToPointer - The assignment converts an int to a pointer, which we accept as an extension.
@ IncompatibleBlockPointer
IncompatibleBlockPointer - The assignment is between two block pointers types that are not compatible...
@ IncompatibleObjCQualifiedId
IncompatibleObjCQualifiedId - The assignment is between a qualified id type and something else (that ...
@ IncompatibleVectors
IncompatibleVectors - The assignment is between two vector types that have the same size,...
@ CompatiblePointerDiscardsQualifiers
CompatiblePointerDiscardsQualifiers - The assignment discards c/v/r qualifiers, which we accept as an...
@ IncompatiblePointer
IncompatiblePointer - The assignment is between two pointers types that are not compatible,...
@ IncompatibleObjCWeakRef
IncompatibleObjCWeakRef - Assigning a weak-unavailable object to an object with __weak qualifier.
@ Compatible
Compatible - the types are compatible according to the standard.
@ Incompatible
Incompatible - We reject this conversion outright, it is invalid to represent it in the AST.
@ FunctionVoidPointer
FunctionVoidPointer - The assignment is between a function pointer and void*, which the standard does...
@ IncompatibleFunctionPointer
IncompatibleFunctionPointer - The assignment is between two function pointers types that are not comp...
@ IncompatiblePointerSign
IncompatiblePointerSign - The assignment is between two pointers types which point to integers which ...
@ IncompatibleNestedPointerQualifiers
IncompatibleNestedPointerQualifiers - The assignment is between two nested pointer types,...
@ IncompatibleNestedPointerAddressSpaceMismatch
IncompatibleNestedPointerAddressSpaceMismatch - The assignment changes address spaces in nested point...
@ PointerToInt
PointerToInt - The assignment converts a pointer to an int, which we accept as an extension.
@ IntToBlockPointer
IntToBlockPointer - The assignment converts an int to a block pointer.
void CheckShadowingDeclModification(Expr *E, SourceLocation Loc)
Warn if 'E', which is an expression that is about to be modified, refers to a shadowing declaration.
ArithConvKind
Context in which we're performing a usual arithmetic conversion.
@ ACK_Arithmetic
An arithmetic operation.
@ ACK_CompAssign
A compound assignment expression.
@ ACK_BitwiseOp
A bitwise operation.
@ ACK_Conditional
A conditional (?:) operator.
@ ACK_Comparison
A comparison.
void MarkDeclRefReferenced(DeclRefExpr *E, const Expr *Base=nullptr)
Perform reference-marking and odr-use handling for a DeclRefExpr.
ExprResult ActOnParenExpr(SourceLocation L, SourceLocation R, Expr *E)
void CheckFloatComparison(SourceLocation Loc, Expr *LHS, Expr *RHS)
Check for comparisons of floating point operands using != and ==.
llvm::PointerIntPair< ConstantExpr *, 1 > ImmediateInvocationCandidate
ExprResult CheckPlaceholderExpr(Expr *E)
Check for operands with placeholder types and complain if found.
ExprResult TransformToPotentiallyEvaluated(Expr *E)
EnableIfAttr * CheckEnableIf(FunctionDecl *Function, SourceLocation CallLoc, ArrayRef< Expr * > Args, bool MissingImplicitThis=false)
Check the enable_if expressions on the given function.
@ CCK_ImplicitConversion
An implicit conversion.
bool inTemplateInstantiation() const
Determine whether we are currently performing template instantiation.
SourceManager & getSourceManager() const
@ TryCapture_ExplicitByRef
ExprResult checkPseudoObjectRValue(Expr *E)
bool CheckVecStepExpr(Expr *E)
ExprResult BuildUnaryOp(Scope *S, SourceLocation OpLoc, UnaryOperatorKind Opc, Expr *Input)
void diagnoseARCUnbridgedCast(Expr *e)
Given that we saw an expression with the ARCUnbridgedCastTy placeholder type, complain bitterly.
FunctionDecl * ResolveSingleFunctionTemplateSpecialization(OverloadExpr *ovl, bool Complain=false, DeclAccessPair *Found=nullptr)
Given an expression that refers to an overloaded function, try to resolve that overloaded function ex...
ExprResult ActOnConditionalOp(SourceLocation QuestionLoc, SourceLocation ColonLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr)
ActOnConditionalOp - Parse a ?: operation.
QualType CheckVectorCompareOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc)
CheckVectorCompareOperands - vector comparisons are a clang extension that operates on extended vecto...
QualType CheckMultiplyDivideOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign, bool IsDivide)
ExprResult CheckCXXBooleanCondition(Expr *CondExpr, bool IsConstexpr=false)
CheckCXXBooleanCondition - Returns true if conversion to bool is invalid.
ExprResult CheckLValueToRValueConversionOperand(Expr *E)
bool ResolveAndFixSingleFunctionTemplateSpecialization(ExprResult &SrcExpr, bool DoFunctionPointerConverion=false, bool Complain=false, SourceRange OpRangeForComplaining=SourceRange(), QualType DestTypeForComplaining=QualType(), unsigned DiagIDForComplaining=0)
void DiscardMisalignedMemberAddress(const Type *T, Expr *E)
This function checks if the expression is in the sef of potentially misaligned members and it is conv...
DeclContext * computeDeclContext(QualType T)
Compute the DeclContext that is associated with the given type.
ExprResult SemaConvertVectorExpr(Expr *E, TypeSourceInfo *TInfo, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
SemaConvertVectorExpr - Handle __builtin_convertvector.
ExprResult ActOnObjCBoolLiteral(SourceLocation OpLoc, tok::TokenKind Kind)
ActOnObjCBoolLiteral - Parse {__objc_yes,__objc_no} literals.
bool resolveAndFixAddressOfSingleOverloadCandidate(ExprResult &SrcExpr, bool DoFunctionPointerConversion=false)
Given an overloaded function, tries to turn it into a non-overloaded function reference using resolve...
ARCConversionResult CheckObjCConversion(SourceRange castRange, QualType castType, Expr *&op, CheckedConversionKind CCK, bool Diagnose=true, bool DiagnoseCFAudited=false, BinaryOperatorKind Opc=BO_PtrMemD)
Checks for invalid conversions and casts between retainable pointers and other pointer kinds for ARC ...
QualType CheckPointerToMemberOperands(ExprResult &LHS, ExprResult &RHS, ExprValueKind &VK, SourceLocation OpLoc, bool isIndirect)
bool DiagRuntimeBehavior(SourceLocation Loc, const Stmt *Statement, const PartialDiagnostic &PD)
Conditionally issue a diagnostic based on the current evaluation context.
bool isLaxVectorConversion(QualType srcType, QualType destType)
Is this a legal conversion between two types, one of which is known to be a vector type?
void PushBlockScope(Scope *BlockScope, BlockDecl *Block)
bool CheckCXXDefaultArgExpr(SourceLocation CallLoc, FunctionDecl *FD, ParmVarDecl *Param)
Instantiate or parse a C++ default argument expression as necessary.
ExprResult BuildOverloadedCallExpr(Scope *S, Expr *Fn, UnresolvedLookupExpr *ULE, SourceLocation LParenLoc, MultiExprArg Args, SourceLocation RParenLoc, Expr *ExecConfig, bool AllowTypoCorrection=true, bool CalleesAddressIsTaken=false)
BuildOverloadedCallExpr - Given the call expression that calls Fn (which eventually refers to the dec...
QualType CXXCheckConditionalOperands(ExprResult &cond, ExprResult &lhs, ExprResult &rhs, ExprValueKind &VK, ExprObjectKind &OK, SourceLocation questionLoc)
Check the operands of ?: under C++ semantics.
ExprResult BuildAnonymousStructUnionMemberReference(const CXXScopeSpec &SS, SourceLocation nameLoc, IndirectFieldDecl *indirectField, DeclAccessPair FoundDecl=DeclAccessPair::make(nullptr, AS_none), Expr *baseObjectExpr=nullptr, SourceLocation opLoc=SourceLocation())
MaybeODRUseExprSet MaybeODRUseExprs
bool CheckParmsForFunctionDef(ArrayRef< ParmVarDecl * > Parameters, bool CheckParameterNames)
Helpers for dealing with blocks and functions.
void CheckShadow(NamedDecl *D, NamedDecl *ShadowedDecl, const LookupResult &R)
Diagnose variable or built-in function shadowing.
ExprResult BuildCallToObjectOfClassType(Scope *S, Expr *Object, SourceLocation LParenLoc, MultiExprArg Args, SourceLocation RParenLoc)
BuildCallToObjectOfClassType - Build a call to an object of class type (C++ [over....
ExprResult ActOnStringLiteral(ArrayRef< Token > StringToks, Scope *UDLScope=nullptr)
ActOnStringLiteral - The specified tokens were lexed as pasted string fragments (e....
bool isCompleteType(SourceLocation Loc, QualType T, CompleteTypeKind Kind=CompleteTypeKind::Default)
ExprResult ActOnBinOp(Scope *S, SourceLocation TokLoc, tok::TokenKind Kind, Expr *LHSExpr, Expr *RHSExpr)
VarDecl * isOpenMPCapturedDecl(ValueDecl *D, bool CheckScopeInfo=false, unsigned StopAt=0)
Check if the specified variable is used in one of the private clauses (private, firstprivate,...
ExprResult CheckExtVectorCast(SourceRange R, QualType DestTy, Expr *CastExpr, CastKind &Kind)
void setFunctionHasBranchProtectedScope()
ExprResult ActOnOMPArrayShapingExpr(Expr *Base, SourceLocation LParenLoc, SourceLocation RParenLoc, ArrayRef< Expr * > Dims, ArrayRef< SourceRange > Brackets)
bool CheckLoopHintExpr(Expr *E, SourceLocation Loc)
void InstantiateFunctionDefinition(SourceLocation PointOfInstantiation, FunctionDecl *Function, bool Recursive=false, bool DefinitionRequired=false, bool AtEndOfTU=false)
Instantiate the definition of the given function from its template.
QualType CheckAssignmentOperands(Expr *LHSExpr, ExprResult &RHS, SourceLocation Loc, QualType CompoundType)
FunctionDecl * getCurFunctionDecl()
getCurFunctionDecl - If inside of a function body, this returns a pointer to the function decl for th...
void mergeDeclAttributes(NamedDecl *New, Decl *Old, AvailabilityMergeKind AMK=AMK_Redeclaration)
mergeDeclAttributes - Copy attributes from the Old decl to the New one.
const DeclContext * getCurObjCLexicalContext() const
bool CheckPointerConversion(Expr *From, QualType ToType, CastKind &Kind, CXXCastPath &BasePath, bool IgnoreBaseAccess, bool Diagnose=true)
CheckPointerConversion - Check the pointer conversion from the expression From to the type ToType.
SmallVector< ExprWithCleanups::CleanupObject, 8 > ExprCleanupObjects
ExprCleanupObjects - This is the stack of objects requiring cleanup that are created by the current f...
void NoteDeletedFunction(FunctionDecl *FD)
Emit a note explaining that this function is deleted.
sema::AnalysisBasedWarnings AnalysisWarnings
Worker object for performing CFG-based warnings.
std::deque< PendingImplicitInstantiation > PendingInstantiations
The queue of implicit template instantiations that are required but have not yet been performed.
ExprResult CreateBuiltinArraySubscriptExpr(Expr *Base, SourceLocation LLoc, Expr *Idx, SourceLocation RLoc)
void NoteAllOverloadCandidates(Expr *E, QualType DestType=QualType(), bool TakingAddress=false)
ExprResult ActOnPredefinedExpr(SourceLocation Loc, tok::TokenKind Kind)
QualType GetSignedVectorType(QualType V)
QualType CheckConditionalOperands(ExprResult &Cond, ExprResult &LHS, ExprResult &RHS, ExprValueKind &VK, ExprObjectKind &OK, SourceLocation QuestionLoc)
Note that LHS is not null here, even if this is the gnu "x ?: y" extension.
ExpressionEvaluationContext
Describes how the expressions currently being parsed are evaluated at run-time, if at all.
@ UnevaluatedAbstract
The current expression occurs within an unevaluated operand that unconditionally permits abstract ref...
@ UnevaluatedList
The current expression occurs within a braced-init-list within an unevaluated operand.
@ ConstantEvaluated
The current context is "potentially evaluated" in C++11 terms, but the expression is evaluated at com...
@ DiscardedStatement
The current expression occurs within a discarded statement.
@ PotentiallyEvaluated
The current expression is potentially evaluated at run time, which means that code may be generated t...
@ Unevaluated
The current expression and its subexpressions occur within an unevaluated operand (C++11 [expr]p7),...
@ PotentiallyEvaluatedIfUsed
The current expression is potentially evaluated, but any declarations referenced inside that expressi...
void CheckCompatibleReinterpretCast(QualType SrcType, QualType DestType, bool IsDereference, SourceRange Range)
ExprResult BuildDependentDeclRefExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs)
ExprResult ActOnAsTypeExpr(Expr *E, ParsedType ParsedDestTy, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
__builtin_astype(...)
ExprResult CreateUnaryExprOrTypeTraitExpr(TypeSourceInfo *TInfo, SourceLocation OpLoc, UnaryExprOrTypeTrait ExprKind, SourceRange R)
Build a sizeof or alignof expression given a type operand.
void diagnoseTypo(const TypoCorrection &Correction, const PartialDiagnostic &TypoDiag, bool ErrorRecovery=true)
bool CheckCallReturnType(QualType ReturnType, SourceLocation Loc, CallExpr *CE, FunctionDecl *FD)
CheckCallReturnType - Checks that a call expression's return type is complete.
bool CheckUnaryExprOrTypeTraitOperand(Expr *E, UnaryExprOrTypeTrait ExprKind)
Check the constraints on expression operands to unary type expression and type traits.
ExprResult ActOnVAArg(SourceLocation BuiltinLoc, Expr *E, ParsedType Ty, SourceLocation RPLoc)
TypeSourceInfo * GetTypeForDeclaratorCast(Declarator &D, QualType FromTy)
bool RequireCompleteType(SourceLocation Loc, QualType T, CompleteTypeKind Kind, TypeDiagnoser &Diagnoser)
Ensure that the type T is a complete type.
Scope * TUScope
Translation Unit Scope - useful to Objective-C actions that need to lookup file scope declarations in...
PartialDiagnostic PDiag(unsigned DiagID=0)
Build a partial diagnostic.
ExprResult forceUnknownAnyToType(Expr *E, QualType ToType)
Force an expression with unknown-type to an expression of the given type.
ExprResult ActOnArraySubscriptExpr(Scope *S, Expr *Base, SourceLocation LLoc, Expr *Idx, SourceLocation RLoc)
bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, bool InUnqualifiedLookup=false)
Perform qualified name lookup into a given context.
void NoteDeletedInheritingConstructor(CXXConstructorDecl *CD)
ExprResult ActOnCastExpr(Scope *S, SourceLocation LParenLoc, Declarator &D, ParsedType &Ty, SourceLocation RParenLoc, Expr *CastExpr)
ExprResult BuildPredefinedExpr(SourceLocation Loc, PredefinedExpr::IdentKind IK)
Expr * MaybeCreateExprWithCleanups(Expr *SubExpr)
MaybeCreateExprWithCleanups - If the current full-expression requires any cleanups,...
ExprResult BuildObjCSubscriptExpression(SourceLocation RB, Expr *BaseExpr, Expr *IndexExpr, ObjCMethodDecl *getterMethod, ObjCMethodDecl *setterMethod)
Build an ObjC subscript pseudo-object expression, given that that's supported by the runtime.
bool RebuildingImmediateInvocation
Whether the AST is currently being rebuilt to correct immediate invocations.
void DiagnoseAvailabilityOfDecl(NamedDecl *D, ArrayRef< SourceLocation > Locs, const ObjCInterfaceDecl *UnknownObjCClass, bool ObjCPropertyAccess, bool AvoidPartialAvailabilityChecks=false, ObjCInterfaceDecl *ClassReceiver=nullptr)
void DiscardCleanupsInEvaluationContext()
SmallVector< ExpressionEvaluationContextRecord, 8 > ExprEvalContexts
A stack of expression evaluation contexts.
void PushDeclContext(Scope *S, DeclContext *DC)
Set the current declaration context until it gets popped.
bool CheckVectorCast(SourceRange R, QualType VectorTy, QualType Ty, CastKind &Kind)
bool LookupTemplateName(LookupResult &R, Scope *S, CXXScopeSpec &SS, QualType ObjectType, bool EnteringContext, bool &MemberOfUnknownSpecialization, RequiredTemplateKind RequiredTemplate=SourceLocation(), AssumedTemplateKind *ATK=nullptr, bool AllowTypoCorrection=true)
bool isOpenMPCapturedByRef(const ValueDecl *D, unsigned Level, unsigned OpenMPCaptureLevel) const
Return true if the provided declaration VD should be captured by reference.
ExprResult BuildVectorLiteral(SourceLocation LParenLoc, SourceLocation RParenLoc, Expr *E, TypeSourceInfo *TInfo)
Build an altivec or OpenCL literal.
void checkRetainCycles(ObjCMessageExpr *msg)
checkRetainCycles - Check whether an Objective-C message send might create an obvious retain cycle.
bool isUnavailableAlignedAllocationFunction(const FunctionDecl &FD) const
Determine whether FD is an aligned allocation or deallocation function that is unavailable.
DiagnosticsEngine & Diags
OpenCLOptions & getOpenCLOptions()
bool DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R, CorrectionCandidateCallback &CCC, TemplateArgumentListInfo *ExplicitTemplateArgs=nullptr, ArrayRef< Expr * > Args=None, TypoExpr **Out=nullptr)
Diagnose an empty lookup.
ExprResult DefaultFunctionArrayConversion(Expr *E, bool Diagnose=true)
DefaultFunctionArrayConversion (C99 6.3.2.1p3, C99 6.3.2.1p4).
void deduceClosureReturnType(sema::CapturingScopeInfo &CSI)
Deduce a block or lambda's return type based on the return statements present in the body.
bool areLaxCompatibleVectorTypes(QualType srcType, QualType destType)
Are the two types lax-compatible vector types? That is, given that one of them is a vector,...
ExprResult PerformCopyInitialization(const InitializedEntity &Entity, SourceLocation EqualLoc, ExprResult Init, bool TopLevelOfInitList=false, bool AllowExplicit=false)
void diagnoseMissingTemplateArguments(TemplateName Name, SourceLocation Loc)
void DiagnoseAssignmentAsCondition(Expr *E)
DiagnoseAssignmentAsCondition - Given that an expression is being used as a boolean condition,...
void checkSpecializationVisibility(SourceLocation Loc, NamedDecl *Spec)
We've found a use of a templated declaration that would trigger an implicit instantiation.
void EmitRelatedResultTypeNote(const Expr *E)
If the given expression involves a message send to a method with a related result type,...
QualType CheckBitwiseOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc)
llvm::MapVector< NamedDecl *, SourceLocation > UndefinedButUsed
UndefinedInternals - all the used, undefined objects which require a definition in this translation u...
ExprResult ActOnStmtExpr(Scope *S, SourceLocation LPLoc, Stmt *SubStmt, SourceLocation RPLoc)
void checkVariadicArgument(const Expr *E, VariadicCallType CT)
Check to see if the given expression is a valid argument to a variadic function, issuing a diagnostic...
void CheckStaticArrayArgument(SourceLocation CallLoc, ParmVarDecl *Param, const Expr *ArgExpr)
CheckStaticArrayArgument - If the given argument corresponds to a static array parameter,...
void FilterLookupForScope(LookupResult &R, DeclContext *Ctx, Scope *S, bool ConsiderLinkage, bool AllowInlineNamespace)
Filters out lookup results that don't fall within the given scope as determined by isDeclInScope.
bool DiagnoseConditionalForNull(Expr *LHSExpr, Expr *RHSExpr, SourceLocation QuestionLoc)
Emit a specialized diagnostic when one expression is a null pointer constant and the other is not a p...
ExprResult BuildObjCNumericLiteral(SourceLocation AtLoc, Expr *Number)
BuildObjCNumericLiteral - builds an ObjCBoxedExpr AST node for the numeric literal expression.
Expr * FixOverloadedFunctionReference(Expr *E, DeclAccessPair FoundDecl, FunctionDecl *Fn)
FixOverloadedFunctionReference - E is an expression that refers to a C++ overloaded function (possibl...
void checkNonTrivialCUnionInInitializer(const Expr *Init, SourceLocation Loc)
Emit diagnostics if the initializer or any of its explicit or implicitly-generated subexpressions req...
ExprResult ActOnBlockStmtExpr(SourceLocation CaretLoc, Stmt *Body, Scope *CurScope)
ActOnBlockStmtExpr - This is called when the body of a block statement literal was successfully compl...
void DiagnoseDeletedDefaultedFunction(FunctionDecl *FD)
Produce notes explaining why a defaulted function was defined as deleted.
void runWithSufficientStackSpace(SourceLocation Loc, llvm::function_ref< void()> Fn)
Run some code with "sufficient" stack space.
void MarkMemberReferenced(MemberExpr *E)
Perform reference-marking and odr-use handling for a MemberExpr.
bool DiagnoseAssignmentResult(AssignConvertType ConvTy, SourceLocation Loc, QualType DstType, QualType SrcType, Expr *SrcExpr, AssignmentAction Action, bool *Complained=nullptr)
DiagnoseAssignmentResult - Emit a diagnostic, if required, for the assignment conversion type specifi...
void MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func, bool MightBeOdrUse=true)
Mark a function referenced, and check whether it is odr-used (C++ [basic.def.odr]p2,...
bool RequireCompleteSizedType(SourceLocation Loc, QualType T, unsigned DiagID, const Ts &... Args)
ExprResult ActOnStmtExprResult(ExprResult E)
ExprResult ActOnPostfixUnaryOp(Scope *S, SourceLocation OpLoc, tok::TokenKind Kind, Expr *Input)
bool GatherArgumentsForCall(SourceLocation CallLoc, FunctionDecl *FDecl, const FunctionProtoType *Proto, unsigned FirstParam, ArrayRef< Expr * > Args, SmallVectorImpl< Expr * > &AllArgs, VariadicCallType CallType=VariadicDoesNotApply, bool AllowExplicit=false, bool IsListInitialization=false)
GatherArgumentsForCall - Collector argument expressions for various form of call prototypes.
std::tuple< MangleNumberingContext *, Decl * > getCurrentMangleNumberContext(const DeclContext *DC)
Compute the mangling number context for a lambda expression or block literal.
bool CheckConversionToObjCLiteral(QualType DstType, Expr *&SrcExpr, bool Diagnose=true)
void DiagnoseEqualityWithExtraParens(ParenExpr *ParenE)
Redundant parentheses over an equality comparison can indicate that the user intended an assignment u...
ExprResult CreateRecoveryExpr(SourceLocation Begin, SourceLocation End, ArrayRef< Expr * > SubExprs, QualType T=QualType())
Attempts to produce a RecoveryExpr after some AST node cannot be created.
ExprResult BuildBinOp(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr)
ExprResult ActOnNumericConstant(const Token &Tok, Scope *UDLScope=nullptr)
ExprResult PerformObjectMemberConversion(Expr *From, NestedNameSpecifier *Qualifier, NamedDecl *FoundDecl, NamedDecl *Member)
Cast a base object to a member's actual type.
ExprResult BuildInitList(SourceLocation LBraceLoc, MultiExprArg InitArgList, SourceLocation RBraceLoc)
TypeSourceInfo * GetTypeForDeclarator(Declarator &D, Scope *S)
GetTypeForDeclarator - Convert the type for the specified declarator to Type instances.
void ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope)
ActOnBlockStart - This callback is invoked when a block literal is started.
ExprResult CreateBuiltinBinOp(SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr)
CreateBuiltinBinOp - Creates a new built-in binary operation with operator Opc at location TokLoc.
AssignConvertType CheckAssignmentConstraints(SourceLocation Loc, QualType LHSType, QualType RHSType)
CheckAssignmentConstraints - Perform type checking for assignment, argument passing,...
void DiagnoseUnsatisfiedConstraint(const ConstraintSatisfaction &Satisfaction, bool First=true)
Emit diagnostics explaining why a constraint expression was deemed unsatisfied.
bool IsDerivedFrom(SourceLocation Loc, QualType Derived, QualType Base)
Determine whether the type Derived is a C++ class that is derived from the type Base.
ExprResult ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig=nullptr)
ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
ExprResult ActOnUnaryExprOrTypeTraitExpr(SourceLocation OpLoc, UnaryExprOrTypeTrait ExprKind, bool IsType, void *TyOrEx, SourceRange ArgRange)
ActOnUnaryExprOrTypeTraitExpr - Handle sizeof(type) and sizeof expr and the same for alignof and __al...
void clearDelayedTypo(TypoExpr *TE)
Clears the state of the given TypoExpr.
@ LOLR_ErrorNoDiagnostic
The lookup found no match but no diagnostic was issued.
@ LOLR_Raw
The lookup found a single 'raw' literal operator, which expects a string literal containing the spell...
@ LOLR_Error
The lookup resulted in an error.
@ LOLR_Cooked
The lookup found a single 'cooked' literal operator, which expects a normal literal to be built and p...
@ LOLR_StringTemplatePack
The lookup found an overload set of literal operator templates, which expect the character type and c...
@ LOLR_Template
The lookup found an overload set of literal operator templates, which expect the characters of the sp...
sema::FunctionScopeInfo * getEnclosingFunction() const
void ActOnBlockArguments(SourceLocation CaretLoc, Declarator &ParamInfo, Scope *CurScope)
ActOnBlockArguments - This callback allows processing of block arguments.
QualType CheckRemainderOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign=false)
@ Diagnose
Diagnose issues that are non-constant or that are extensions.
ConditionResult ActOnCondition(Scope *S, SourceLocation Loc, Expr *SubExpr, ConditionKind CK)
sema::CapturedRegionScopeInfo * getCurCapturedRegion()
Retrieve the current captured region, if any.
unsigned getTemplateDepth(Scope *S) const
Determine the number of levels of enclosing template parameters.
bool checkOpenCLDisabledDecl(const NamedDecl &D, const Expr &E)
Check if declaration D used by expression E is disabled due to required OpenCL extensions being disab...
static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo=nullptr)
ExprResult CreateOverloadedArraySubscriptExpr(SourceLocation LLoc, SourceLocation RLoc, Expr *Base, Expr *Idx)
ExprResult ActOnObjCAvailabilityCheckExpr(llvm::ArrayRef< AvailabilitySpec > AvailSpecs, SourceLocation AtLoc, SourceLocation RParen)
bool IsStringLiteralToNonConstPointerConversion(Expr *From, QualType ToType)
Helper function to determine whether this is the (deprecated) C++ conversion from a string literal to...
ExprResult CreateBuiltinUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc, Expr *InputExpr)
void computeNRVO(Stmt *Body, sema::FunctionScopeInfo *Scope)
Given the set of return statements within a function body, compute the variables that are subject to ...
void checkNonTrivialCUnion(QualType QT, SourceLocation Loc, NonTrivialCUnionContext UseContext, unsigned NonTrivialKind)
Emit diagnostics if a non-trivial C union type or a struct that contains a non-trivial C union is use...
QualType CheckSubtractionOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, QualType *CompLHSTy=nullptr)
static ConditionResult ConditionError()
ExprResult ActOnConvertVectorExpr(Expr *E, ParsedType ParsedDestTy, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
__builtin_convertvector(...)
void HandleFunctionTypeMismatch(PartialDiagnostic &PDiag, QualType FromType, QualType ToType)
HandleFunctionTypeMismatch - Gives diagnostic information for differeing function types.
ExprResult ActOnOMPIteratorExpr(Scope *S, SourceLocation IteratorKwLoc, SourceLocation LLoc, SourceLocation RLoc, ArrayRef< OMPIteratorData > Data)
const TypoExprState & getTypoExprState(TypoExpr *TE) const
void DiagnoseUnusedExprResult(const Stmt *S)
DiagnoseUnusedExprResult - If the statement passed in is an expression whose result is unused,...
ExprResult BuildPossibleImplicitMemberExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, const TemplateArgumentListInfo *TemplateArgs, const Scope *S, UnresolvedLookupExpr *AsULE=nullptr)
Builds an expression which might be an implicit member expression.
ExprResult checkUnknownAnyArg(SourceLocation callLoc, Expr *result, QualType ¶mType)
Type-check an expression that's being passed to an __unknown_anytype parameter.
bool ConvertArgumentsForCall(CallExpr *Call, Expr *Fn, FunctionDecl *FDecl, const FunctionProtoType *Proto, ArrayRef< Expr * > Args, SourceLocation RParenLoc, bool ExecConfig=false)
ConvertArgumentsForCall - Converts the arguments specified in Args/NumArgs to the parameter types of ...
ExprResult ActOnBuiltinOffsetOf(Scope *S, SourceLocation BuiltinLoc, SourceLocation TypeLoc, ParsedType ParsedArgTy, ArrayRef< OffsetOfComponent > Components, SourceLocation RParenLoc)
OpenMPClauseKind isOpenMPPrivateDecl(ValueDecl *D, unsigned Level, unsigned CapLevel) const
Check if the specified variable is used in 'private' clause.
bool hasAnyUnrecoverableErrorsInThisFunction() const
Determine whether any errors occurred within this function/method/ block.
FullExprArg MakeFullExpr(Expr *Arg)
bool IsFunctionConversion(QualType FromType, QualType ToType, QualType &ResultTy)
Determine whether the conversion from FromType to ToType is a valid conversion that strips "noexcept"...
bool isExternalWithNoLinkageType(ValueDecl *VD)
Determine if VD, which must be a variable or function, is an external symbol that nonetheless can't b...
llvm::SmallVector< std::pair< SourceLocation, const BlockDecl * >, 1 > ImplicitlyRetainedSelfLocs
List of SourceLocations where 'self' is implicitly retained inside a block.
bool isOpenMPTargetCapturedDecl(const ValueDecl *D, unsigned Level, unsigned CaptureLevel) const
Check if the specified variable is captured by 'target' directive.
ExprResult HandleExprEvaluationContextForTypeof(Expr *E)
ExprResult ActOnInitList(SourceLocation LBraceLoc, MultiExprArg InitArgList, SourceLocation RBraceLoc)
SemaDiagnosticBuilder targetDiag(SourceLocation Loc, unsigned DiagID, FunctionDecl *FD=nullptr)
ExprResult CorrectDelayedTyposInExpr(Expr *E, VarDecl *InitDecl=nullptr, bool RecoverUncorrectedTypos=false, llvm::function_ref< ExprResult(Expr *)> Filter=[](Expr *E) -> ExprResult { return E;})
Process any TypoExprs in the given Expr and its children, generating diagnostics as appropriate and r...
ExprResult ActOnFinishFullExpr(Expr *Expr, bool DiscardedValue)
void FinalizeVarWithDestructor(VarDecl *VD, const RecordType *DeclInitType)
FinalizeVarWithDestructor - Prepare for calling destructor on the constructed variable.
ExprResult CreateBuiltinMatrixSubscriptExpr(Expr *Base, Expr *RowIdx, Expr *ColumnIdx, SourceLocation RBLoc)
Represents a function call to one of __builtin_LINE(), __builtin_COLUMN(), __builtin_FUNCTION(),...
Encodes a location in the source.
SourceLocation getLocWithOffset(int Offset) const
Return a source location with the specified offset from this SourceLocation.
bool isValid() const
Return true if this is a valid SourceLocation object.
bool isInMainFile(SourceLocation Loc) const
Returns whether the PresumedLoc for a given SourceLocation is in the main file.
A trivial tuple used to represent a source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
StandardConversionSequence - represents a standard conversion sequence (C++ 13.3.3....
ImplicitConversionKind Second
Second - The second conversion can be an integral promotion, floating point promotion,...
void setAsIdentityConversion()
StandardConversionSequence - Set the standard conversion sequence to the identity conversion.
void setToType(unsigned Idx, QualType T)
NarrowingKind getNarrowingKind(ASTContext &Context, const Expr *Converted, APValue &ConstantValue, QualType &ConstantType, bool IgnoreFloatToIntegralConversion=false) const
Check if this standard conversion sequence represents a narrowing conversion, according to C++11 [dcl...
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
StmtVisitor - This class implements a simple visitor for Stmt subclasses.
Stmt - This represents one statement.
SourceLocation getEndLoc() const LLVM_READONLY
StmtClass getStmtClass() const
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
SourceLocation getBeginLoc() const LLVM_READONLY
StringLiteralParser - This decodes string escape characters and performs wide string analysis and Tra...
unsigned getUDSuffixToken() const
Get the index of a token containing a ud-suffix.
unsigned getUDSuffixOffset() const
Get the spelling offset of the first byte of the ud-suffix.
StringRef getUDSuffix() const
unsigned GetNumStringChars() const
StringRef GetString() const
StringLiteral - This represents a string literal expression, e.g.
unsigned getLength() const
StringKind
StringLiteral is followed by several trailing objects.
uint32_t getCodeUnit(size_t i) const
static StringLiteral * Create(const ASTContext &Ctx, StringRef Str, StringKind Kind, bool Pascal, QualType Ty, const SourceLocation *Loc, unsigned NumConcatenated)
This is the "fully general" constructor that allows representation of strings formed from multiple co...
bool hasNameForLinkage() const
Is this tag type named, either directly or via being defined in a typedef of this type?
bool isMicrosoft() const
Is this ABI an MSVC-compatible ABI?
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
StringRef getPlatformName() const
Retrieve the name of the platform as it is used in the availability attribute.
@ CharPtrBuiltinVaList
typedef char* __builtin_va_list;
virtual bool useFP16ConversionIntrinsics() const
Check whether llvm intrinsics such as llvm.convert.to.fp16 should be used to convert to and from __fp...
unsigned getIntWidth() const
getIntWidth/Align - Return the size of 'signed int' and 'unsigned int' for this target,...
unsigned getLongLongWidth() const
getLongLongWidth/Align - Return the size of 'signed long long' and 'unsigned long long' for this targ...
bool isTLSSupported() const
Whether the target supports thread-local storage.
virtual BuiltinVaListKind getBuiltinVaListKind() const =0
Returns the kind of __builtin_va_list type that should be used with this target.
uint64_t getPointerWidth(unsigned AddrSpace) const
Return the width of pointers on this target, for the specified address space.
bool hasBuiltinMSVaList() const
Returns whether or not type __builtin_ms_va_list type is available on this target.
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
unsigned getIntMaxTWidth() const
Return the size of intmax_t and uintmax_t for this target, in bits.
unsigned getLongWidth() const
getLongWidth/Align - Return the size of 'signed long' and 'unsigned long' for this target,...
virtual bool hasFeature(StringRef Feature) const
Determine whether the given target has the given feature.
A convenient class for passing around template argument information.
void setLAngleLoc(SourceLocation Loc)
void setRAngleLoc(SourceLocation Loc)
void addArgument(const TemplateArgumentLoc &Loc)
Location wrapper for a TemplateArgument.
Represents a template argument.
Expr * getAsExpr() const
Retrieve the template argument as an expression.
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
@ Declaration
The template argument is a declaration that was provided for a pointer, reference,...
@ Expression
The template argument is an expression, and we've not resolved it to one of the other forms yet,...
ArgKind getKind() const
Return the kind of stored template argument.
The base class of all kinds of template declarations (e.g., class, function, etc.).
Represents a C++ template name within the type system.
Token - This structure provides full information about a lexed token.
SourceLocation getLocation() const
Return a source location identifier for the specified offset in the current file.
unsigned getLength() const
void setKind(tok::TokenKind K)
tok::TokenKind getKind() const
void setLocation(SourceLocation L)
void startToken()
Reset all flags to cleared.
void setIdentifierInfo(IdentifierInfo *II)
Represents a declaration of a type.
const Type * getTypeForDecl() const
SourceLocation getBeginLoc() const LLVM_READONLY
TyLocType push(QualType T)
Pushes space for a new TypeLoc of the given type.
TypeSpecTypeLoc pushTypeSpec(QualType T)
Pushes space for a typespec TypeLoc.
TypeSourceInfo * getTypeSourceInfo(ASTContext &Context, QualType T)
Creates a TypeSourceInfo for the given type.
Base wrapper for a particular "section" of type source info.
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
void initializeFullCopy(TypeLoc Other)
Initializes this by copying its information from another TypeLoc of the same type.
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
SourceRange getLocalSourceRange() const
Get the local source range.
T getAsAdjusted() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
SourceLocation getBeginLoc() const
Get the begin source location.
A container of type source information.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
QualType getType() const
Return the type wrapped by this type source info.
void setNameLoc(SourceLocation Loc)
The base class of the type hierarchy.
bool isIncompleteOrObjectType() const
Return true if this is an incomplete or object type, in other words, not a function type.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
bool isFixedPointOrIntegerType() const
Return true if this is a fixed point or integer type.
bool isBlockPointerType() const
bool isBooleanType() const
bool isObjCBuiltinType() const
bool hasAttr(attr::Kind AK) const
Determine whether this type had the specified attribute applied to it (looking through top-level type...
const Type * getPointeeOrArrayElementType() const
If this is a pointer type, return the pointee type.
const RecordType * getAsUnionType() const
NOTE: getAs*ArrayType are methods on ASTContext.
Optional< NullabilityKind > getNullability(const ASTContext &context) const
Determine the nullability of the given type.
bool isPlaceholderType() const
Test for a type which does not represent an actual type-system type but is instead used as a placehol...
bool isComplexType() const
isComplexType() does not include complex integers (a GCC extension).
bool isIntegralOrUnscopedEnumerationType() const
Determine whether this type is an integral or unscoped enumeration type.
bool isConstantArrayType() const
bool canDecayToPointerType() const
Determines whether this type can decay to a pointer type.
bool hasIntegerRepresentation() const
Determine whether this type has an integer representation of some sort, e.g., it is an integer type o...
bool isVoidPointerType() const
const ComplexType * getAsComplexIntegerType() const
bool isFunctionPointerType() const
bool isArithmeticType() const
bool isConstantMatrixType() const
bool isPointerType() const
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
const T * castAs() const
Member-template castAs<specific type>.
bool isPromotableIntegerType() const
More type predicates useful for type checking/promotion.
bool isSpecificPlaceholderType(unsigned K) const
Test for a specific placeholder type.
bool isReferenceType() const
bool isSignedFixedPointType() const
Return true if this is a fixed point type that is signed according to ISO/IEC JTC1 SC22 WG14 N1169.
bool isEnumeralType() const
bool isScalarType() const
bool isVariableArrayType() const
bool isSizelessBuiltinType() const
bool isIntegralType(const ASTContext &Ctx) const
Determine whether this type is an integral type.
bool isObjCQualifiedIdType() const
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isIntegralOrEnumerationType() const
Determine whether this type is an integral or enumeration type.
bool hasUnsignedIntegerRepresentation() const
Determine whether this type has an unsigned integer representation of some sort, e....
bool isExtVectorType() const
bool isAnyCharacterType() const
Determine whether this type is any of the built-in character types.
bool isNonOverloadPlaceholderType() const
Test for a placeholder type other than Overload; see BuiltinType::isNonOverloadPlaceholderType.
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
bool isSpecificBuiltinType(unsigned K) const
Test for a particular builtin type.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
bool isExtIntType() const
bool isAnyComplexType() const
bool isFixedPointType() const
Return true if this is a fixed point type according to ISO/IEC JTC1 SC22 WG14 N1169.
bool isSaturatedFixedPointType() const
Return true if this is a saturated fixed point type according to ISO/IEC JTC1 SC22 WG14 N1169.
ScalarTypeKind getScalarTypeKind() const
Given that this is a scalar type, classify it.
const BuiltinType * getAsPlaceholderType() const
bool hasSignedIntegerRepresentation() const
Determine whether this type has an signed integer representation of some sort, e.g....
bool isMemberPointerType() const
bool isAtomicType() const
bool isOverloadableType() const
Determines whether this is a type for which one can define an overloaded operator.
bool isObjCIdType() const
bool isMatrixType() const
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
bool isComplexIntegerType() const
bool isUnscopedEnumerationType() const
bool isObjCObjectType() const
bool isBlockCompatibleObjCPointerType(ASTContext &ctx) const
const ArrayType * getAsArrayTypeUnsafe() const
A variant of getAs<> for array types which silently discards qualifiers from the outermost type.
bool isObjCLifetimeType() const
Returns true if objects of this type have lifetime semantics under ARC.
bool isBFloat16Type() const
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types,...
bool isFunctionType() const
bool isObjCObjectPointerType() const
bool hasFloatingRepresentation() const
Determine whether this type has a floating-point representation of some sort, e.g....
bool isUnsignedFixedPointType() const
Return true if this is a fixed point type that is unsigned according to ISO/IEC JTC1 SC22 WG14 N1169.
bool isVectorType() const
bool isObjCQualifiedClassType() const
bool isObjCClassType() const
bool isRealFloatingType() const
Floating point categories.
bool isFloatingType() const
bool isUnsignedIntegerType() const
Return true if this is an integer type that is unsigned, according to C99 6.2.5p6 [which returns true...
bool isAnyPointerType() const
TypeClass getTypeClass() const
const T * getAs() const
Member-template getAs<specific type>'.
bool isNullPtrType() const
bool isRecordType() const
Represents the declaration of a typedef-name via the 'typedef' type specifier.
Simple class containing the result of Sema::CorrectTypo.
IdentifierInfo * getCorrectionAsIdentifierInfo() const
std::string getAsString(const LangOptions &LO) const
SourceRange getCorrectionRange() const
void WillReplaceSpecifier(bool ForceReplacement)
DeclClass * getCorrectionDeclAs() const
DeclarationName getCorrection() const
Gets the DeclarationName of the typo correction.
NestedNameSpecifier * getCorrectionSpecifier() const
Gets the NestedNameSpecifier needed to use the typo correction.
bool isOverloaded() const
NamedDecl * getFoundDecl() const
Get the correction declaration found by name lookup (before we looked through using shadow declaratio...
TypoExpr - Internal placeholder for expressions where typo correction still needs to be performed and...
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand.
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
SourceLocation getOperatorLoc() const
getOperatorLoc - Return the location of the operator.
Expr * getSubExpr() const
static OverloadedOperatorKind getOverloadedOperator(Opcode Opc)
Retrieve the overloaded operator kind that corresponds to the given unary opcode.
static UnaryOperator * Create(const ASTContext &C, Expr *input, Opcode opc, QualType type, ExprValueKind VK, ExprObjectKind OK, SourceLocation l, bool CanOverflow, FPOptionsOverride FPFeatures)
bool isIncrementDecrementOp() const
Represents a C++ unqualified-id that has been parsed.
void setImplicitSelfParam(const IdentifierInfo *Id)
Specify that this unqualified-id is an implicit 'self' parameter.
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
static UnresolvedLookupExpr * Create(const ASTContext &Context, CXXRecordDecl *NamingClass, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool RequiresADL, bool Overloaded, UnresolvedSetIterator Begin, UnresolvedSetIterator End)
Represents a C++ member access expression for which lookup produced a set of overloaded functions.
CXXRecordDecl * getNamingClass()
Retrieve the naming class of this lookup.
bool isImplicitAccess() const
True if this is an implicit access, i.e., one in which the member being accessed was not written in t...
A set of unresolved declarations.
A set of unresolved declarations.
Represents a call to the builtin function __builtin_va_arg.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
void setType(QualType newType)
bool isWeak() const
Determine whether this symbol is weakly-imported, or declared with the weak or weak-ref attr.
const Expr * getExprStmt() const
Represents a variable declaration or definition.
VarDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
bool isInitCapture() const
Whether this variable is the implicit variable for a lambda init-capture.
bool isStaticDataMember() const
Determines whether this is a static data member.
bool mightBeUsableInConstantExpressions(const ASTContext &C) const
Determine whether this variable's value might be usable in a constant expression, according to the re...
static VarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S)
void setTemplateSpecializationKind(TemplateSpecializationKind TSK, SourceLocation PointOfInstantiation=SourceLocation())
For a static data member that was instantiated from a static data member of a class template,...
bool isInline() const
Whether this variable is (C++1z) inline.
const Expr * getInit() const
bool isARCPseudoStrong() const
Determine whether this variable is an ARC pseudo-__strong variable.
bool hasLocalStorage() const
Returns true if a variable with function scope is a non-static local variable.
@ TLS_None
Not a TLS variable.
@ DeclarationOnly
This declaration is only a declaration.
DefinitionKind hasDefinition(ASTContext &) const
Check whether this variable is defined in this translation unit.
bool isUsableInConstantExpressions(const ASTContext &C) const
Determine whether this variable's value can be used in a constant expression, according to the releva...
SourceLocation getPointOfInstantiation() const
If this variable is an instantiation of a variable template or a static data member of a class templa...
TemplateSpecializationKind getTemplateSpecializationKind() const
If this variable is an instantiation of a variable template or a static data member of a class templa...
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this variable is an instantiation of a static data member of a class template specialization,...
Declaration of a variable template.
Represents a C array with a specified size that is not an integer-constant-expression.
Expr * getSizeExpr() const
Represents a GCC generic vector type.
unsigned getNumElements() const
@ AltiVecBool
is AltiVec 'vector bool ...'
@ SveFixedLengthPredicateVector
is AArch64 SVE fixed-length predicate vector
@ GenericVector
not a target-specific vector type
@ SveFixedLengthDataVector
is AArch64 SVE fixed-length data vector
@ AltiVecVector
is AltiVec vector
@ NeonVector
is ARM Neon vector
VectorKind getVectorKind() const
QualType getElementType() const
Policy getDefaultPolicy()
Retains information about a block that is currently being parsed.
Scope * TheScope
TheScope - This is the scope for the block itself, which contains arguments etc.
QualType FunctionType
BlockType - The function type of the block, if one was given.
bool isBlockCapture() const
SourceLocation getLocation() const
Retrieve the location at which this variable was captured.
void markUsed(bool IsODRUse)
bool isThisCapture() const
QualType getCaptureType() const
Retrieve the capture type for this capture, which is effectively the type of the non-static data memb...
bool isCopyCapture() const
VarDecl * getVariable() const
Retains information about a captured region.
unsigned short OpenMPLevel
unsigned short CapRegionKind
The kind of captured region.
unsigned short OpenMPCaptureLevel
void addVLATypeCapture(SourceLocation Loc, const VariableArrayType *VLAType, QualType CaptureType)
QualType ReturnType
ReturnType - The target type of return statements in this context, or null if unknown.
Capture & getCapture(VarDecl *Var)
Retrieve the capture of the given variable, if it has been captured already.
void addCapture(VarDecl *Var, bool isBlock, bool isByref, bool isNested, SourceLocation Loc, SourceLocation EllipsisLoc, QualType CaptureType, bool Invalid)
SmallVector< Capture, 4 > Captures
Captures - The captures.
ImplicitCaptureStyle ImpCaptureStyle
unsigned CXXThisCaptureIndex
CXXThisCaptureIndex - The (index+1) of the capture of 'this'; zero if 'this' is not captured.
bool HasImplicitReturnType
llvm::DenseMap< VarDecl *, unsigned > CaptureMap
CaptureMap - A map of captured variables to (index+1) into Captures.
bool isCXXThisCaptured() const
Determine whether the C++ 'this' is captured.
bool isVLATypeCaptured(const VariableArrayType *VAT) const
Determine whether the given variable-array type has been captured.
Retains information about a function, method, or block that is currently being parsed.
void recordUseOfWeak(const ExprT *E, bool IsRead=true)
Record that a weak object was accessed.
void markSafeWeakUse(const Expr *E)
Record that a given expression is a "safe" access of a weak object (e.g.
void addBlock(const BlockDecl *BD)
bool HasPotentialAvailabilityViolations
Whether we make reference to a declaration that could be unavailable.
void setHasBranchProtectedScope()
bool HasOMPDeclareReductionCombiner
True if current scope is for OpenMP declare reduction combiner.
void addPotentialCapture(Expr *VarExpr)
Add a variable that might potentially be captured by the lambda and therefore the enclosing lambdas.
void addPotentialThisCapture(SourceLocation Loc)
CXXRecordDecl * Lambda
The class that describes the lambda.
CXXMethodDecl * CallOperator
The lambda's compiler-generated operator().
bool Mutable
Whether this is a mutable lambda.
Defines the clang::TargetInfo interface.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
TokenKind
Provides a simple uniform namespace for tokens from all C languages.
Dataflow Directional Tag Classes.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
@ OO_None
Not an overloaded operator.
bool isa(CodeGen::Address addr)
bool isTemplateInstantiation(TemplateSpecializationKind Kind)
Determine whether this template specialization kind refers to an instantiation of an entity (as oppos...
@ OR_Success
Overload resolution succeeded.
bool isTargetAddressSpace(LangAS AS)
DeclContext * getLambdaAwareParentOfDeclContext(DeclContext *DC)
bool isUnresolvedExceptionSpec(ExceptionSpecificationType ESpecType)
NullabilityKind
Describes the nullability of a particular type.
@ Nullable
Values of this type can be null.
@ Unspecified
Whether values of this type can be null is (explicitly) unspecified.
@ NonNull
Values of this type can never be null.
ExprObjectKind
A further classification of the kind of object referenced by an l-value or x-value.
@ OK_VectorComponent
A vector component is an element or range of elements on a vector.
@ OK_ObjCProperty
An Objective-C property is a logical field of an Objective-C object which is read and written via Obj...
@ OK_Ordinary
An ordinary object is located at an address in memory.
@ OK_BitField
A bitfield object is a bitfield on a C or C++ record.
@ OK_MatrixComponent
A matrix component is a single element of a matrix.
@ IK_ImplicitSelfParam
An implicit 'self' parameter.
@ IK_TemplateId
A template-id, e.g., f<int>.
ActionResult< Decl * > DeclResult
UnaryExprOrTypeTrait
Names for the "expression or type" traits.
ObjCMethodFamily
A family of Objective-C methods.
unsigned toTargetAddressSpace(LangAS AS)
@ InternalLinkage
Internal linkage, which indicates that the entity can be referred to from within the translation unit...
TemplateDecl * getAsTypeTemplateDecl(Decl *D)
bool isLambdaCallOperator(const CXXMethodDecl *MD)
@ Result
The result type of a method or function.
ImplicitConversionKind
ImplicitConversionKind - The kind of implicit conversion used to convert an argument to a parameter's...
@ ICK_Complex_Conversion
Complex conversions (C99 6.3.1.6)
@ ICK_Integral_Conversion
Integral conversions (C++ [conv.integral])
@ ICK_Floating_Integral
Floating-integral conversions (C++ [conv.fpint])
@ ICK_Array_To_Pointer
Array-to-pointer conversion (C++ [conv.array])
@ ICK_Identity
Identity conversion (no conversion)
@ ICK_Lvalue_To_Rvalue
Lvalue-to-rvalue conversion (C++ [conv.lval])
@ ICK_Floating_Conversion
Floating point conversions (C++ [conv.double].
@ ICK_Complex_Real
Complex-real conversions (C99 6.3.1.7)
@ ICK_Function_To_Pointer
Function-to-pointer (C++ [conv.array])
LangAS
Defines the address space values used by the address space qualifier of QualType.
CastKind
CastKind - The kind of operation required for a conversion.
OverloadedOperatorKind getRewrittenOverloadedOperator(OverloadedOperatorKind Kind)
Get the other overloaded operator that the given operator can be rewritten into, if any such operator...
@ TNK_Var_template
The name refers to a variable template whose specialization produces a variable.
std::pair< SourceLocation, PartialDiagnostic > PartialDiagnosticAt
A partial diagnostic along with the source location where this diagnostic occurs.
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
@ VK_XValue
An x-value expression is a reference to an object with independent storage but which can be "moved",...
@ VK_RValue
An r-value expression (a pr-value in the C++11 taxonomy) produces a temporary value.
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
const char * getTraitSpelling(ExpressionTrait T) LLVM_READONLY
Return the spelling of the type trait TT. Never null.
@ NK_Not_Narrowing
Not a narrowing conversion.
@ NK_Constant_Narrowing
A narrowing conversion, because a constant expression got narrowed.
@ NK_Dependent_Narrowing
Cannot tell whether this is a narrowing conversion because the expression is value-dependent.
@ NK_Type_Narrowing
A narrowing conversion by virtue of the source and destination types.
@ NK_Variable_Narrowing
A narrowing conversion, because a non-constant-expression variable might have got narrowed.
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
if(T->getSizeExpr()) TRY_TO(TraverseStmt(T -> getSizeExpr()))
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
@ TSK_ExplicitInstantiationDeclaration
This template specialization was instantiated from a template due to an explicit instantiation declar...
@ TSK_ImplicitInstantiation
This template specialization was implicitly instantiated from a template.
@ TSK_Undeclared
This template specialization was formed from a template-id but has not yet been declared,...
CallingConv
CallingConv - Specifies the calling convention that a function uses.
U cast(CodeGen::Address addr)
@ ETK_None
No keyword precedes the qualified type name.
llvm::omp::Clause OpenMPClauseKind
OpenMP clauses.
Optional< ComparisonCategoryType > getComparisonCategoryForBuiltinCmp(QualType T)
Get the comparison category that should be used when comparing values of type T.
ActionResult< Expr * > ExprResult
bool isGenericLambdaCallOperatorSpecialization(const CXXMethodDecl *MD)
NonOdrUseReason
The reason why a DeclRefExpr does not constitute an odr-use.
@ NOUR_Discarded
This name appears as a potential result of a discarded value expression.
@ NOUR_Unevaluated
This name appears in an unevaluated operand.
@ NOUR_None
This is an odr-use.
@ NOUR_Constant
This name appears as a potential result of an lvalue-to-rvalue conversion that is a constant expressi...
Represents an element in a path from a derived class to a base class.
The class facilities generation and storage of conversion FixIts.
OverloadFixItKind Kind
The type of fix applied.
bool tryToFixConversion(const Expr *FromExpr, const QualType FromQTy, const QualType ToQTy, Sema &S)
If possible, generates and stores a fix for the given conversion.
std::vector< FixItHint > Hints
The list of Hints generated so far.
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
SourceLocation getLoc() const
getLoc - Returns the main location of the declaration name.
DeclarationName getName() const
getName - Returns the embedded declaration name.
void setCXXLiteralOperatorNameLoc(SourceLocation Loc)
setCXXLiteralOperatorNameLoc - Sets the location of the literal operator name (not the operator keywo...
SourceLocation getEndLoc() const LLVM_READONLY
EvalResult is a struct with detailed info about an evaluated expression.
APValue Val
Val - This is the value the expression can be folded to.
SmallVectorImpl< PartialDiagnosticAt > * Diag
Diag - If this is non-null, it will be filled in with a stack of notes indicating why evaluation fail...
bool HasSideEffects
Whether the evaluated expression has side effects.
Extra information about a function prototype.
FunctionType::ExtInfo ExtInfo
Iterator definition representation.
SourceLocation AssignmentLoc
SourceLocation SecondColonLoc
Helper expressions and declaration for OMPIteratorExpr class for each iteration space.
Expr * CounterUpdate
Updater for the internal counter: ++CounterVD;.
Expr * Upper
Normalized upper bound.
Expr * Update
Update expression for the originally specified iteration variable, calculated as VD = Begin + Counter...
VarDecl * CounterVD
Internal normalized counter.
bool HasFormOfMemberPointer
OverloadExpr * Expression
@ DefaultFunctionArgumentInstantiation
We are instantiating a default argument for a function.
Data structure used to record current or nested expression evaluation contexts.
SmallVector< Expr *, 2 > VolatileAssignmentLHSs
Expressions appearing as the LHS of a volatile assignment in this context.
llvm::SmallPtrSet< const Expr *, 8 > PossibleDerefs
bool isUnevaluated() const
llvm::SmallPtrSet< DeclRefExpr *, 4 > ReferenceToConsteval
Set of DeclRefExprs referencing a consteval function when used in a context not already known to be i...
llvm::SmallVector< ImmediateInvocationCandidate, 4 > ImmediateInvocationCandidates
Set of candidates for starting an immediate invocation.
enum clang::Sema::ExpressionEvaluationContextRecord::ExpressionKind ExprContext
SmallVector< LambdaExpr *, 2 > Lambdas
The lambdas that are present within this context, if it is indeed an unevaluated context.
ExpressionKind
Describes whether we are in an expression constext which we have to handle differently.
MaybeODRUseExprSet SavedMaybeODRUseExprs
CleanupInfo ParentCleanup
Whether the enclosing context needed a cleanup.
unsigned NumTypos
The number of typos encountered during this expression evaluation context (i.e.
bool isConstantEvaluated() const
unsigned NumCleanupObjects
The number of active cleanup objects when we entered this expression evaluation context.
Data structure for iterator expression.
Abstract class used to diagnose incomplete types.
Location information for a TemplateArgument.